Added jest test.

This commit is contained in:
Zemledelec 2020-01-02 02:35:52 +03:00
parent dd523ba158
commit 0d52cca940
6 changed files with 3893 additions and 2 deletions

11
.babelrc Normal file
View File

@ -0,0 +1,11 @@
{
"presets": [
"@babel/preset-env"
],
"env": {
"test": {
"plugins": [ "transform-es2015-modules-commonjs" ]
}
}
}

4
.gitignore vendored
View File

@ -15,4 +15,6 @@ node_modules
*.map
api
package-lock.json
package-lock.json
coverage

97
jest.config.js Normal file
View File

@ -0,0 +1,97 @@
module.exports = {
clearMocks: true,
coverageDirectory: "coverage",
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: [
"node_modules"
],
// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
// Reset the module registry before running each individual test
// resetModules: false,
// A path to a custom resolver
// resolver: null,
// The root directory that Jest should scan for tests and modules within
//rootDir: "tests",
// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],
// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
// The test environment that will be used for testing
testEnvironment: "node",
// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
// Adds a location field to test results
// testLocationInResults: false,
// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: [
"node_modules"
],
// The regexp pattern or array of patterns that Jest uses to detect test files
testRegex: [
"\\.test\\.js$"
],
// This option allows the use of a custom results processor
// testResultsProcessor: null,
// This option allows use of a custom test runner
// testRunner: "jasmine2",
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",
// A map from regular expressions to paths to transformers
// transform: null,
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "\\\\node_modules\\\\"
// ],
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
// Indicates whether each individual test should be reported during the run
verbose: true,
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],
// Whether to use watchman for file crawling
// watchman: true,
};

3772
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
"build": "node_modules/.bin/webpack --mode=production",
"webgl": "node_modules/.bin/webpack --lib=webgl --mode=production",
"core": "node_modules/.bin/webpack --lib=core --mode=production",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest --coverage"
},
"repository": {
"type": "git",
@ -28,13 +28,17 @@
"homepage": "http://www.openglobus.org",
"dependencies": {},
"devDependencies": {
"@babel/preset-env": "^7.7.7",
"babel-preset-env": "^1.7.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^2.1.1",
"enhanced-resolve": "^4.1.1",
"eslint": "^6.8.0",
"eslint-config-defaults": "^9.0.0",
"eslint-plugin-react": "^7.3.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^1.1.11",
"jest": "^24.9.0",
"local-web-server": "^3.0.7",
"mini-css-extract-plugin": "^0.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",

5
tests/test.test.js Normal file
View File

@ -0,0 +1,5 @@
'use strict';
test('Waiting for tests', () => {
expect(true).toBe(true);
});