mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-23 13:56:51 +00:00
Allow us to write Jest tests!
Change-Id: I6095b08dd72a7ba0ac6bd13c5f5870a1e23c7748
This commit is contained in:
parent
3d95788553
commit
cef90c6286
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
/coverage/
|
||||
/docs/
|
||||
/node_modules/
|
||||
/vendor
|
||||
|
|
61
jest.config.js
Normal file
61
jest.config.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
'use strict';
|
||||
|
||||
// For a detailed explanation regarding each configuration property, visit:
|
||||
// https://jestjs.io/docs/en/configuration.html
|
||||
|
||||
module.exports = {
|
||||
moduleNameMapper: {
|
||||
},
|
||||
|
||||
// Automatically clear mock calls and instances between every test
|
||||
clearMocks: true,
|
||||
|
||||
// Indicates whether the coverage information should be collected while executing the test
|
||||
collectCoverage: true,
|
||||
|
||||
// An array of glob patterns indicating a set of files fo
|
||||
// which coverage information should be collected
|
||||
collectCoverageFrom: [
|
||||
'resources/**/*.(js|vue)'
|
||||
],
|
||||
|
||||
// The directory where Jest should output its coverage files
|
||||
coverageDirectory: 'coverage',
|
||||
|
||||
// An array of regexp pattern strings used to skip coverage collection
|
||||
coveragePathIgnorePatterns: [
|
||||
'/node_modules/'
|
||||
],
|
||||
|
||||
// An object that configures minimum threshold enforcement for coverage results
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
branches: 0,
|
||||
functions: 0,
|
||||
lines: 0,
|
||||
statements: 0
|
||||
}
|
||||
},
|
||||
|
||||
// An array of file extensions your modules use
|
||||
moduleFileExtensions: [
|
||||
'js',
|
||||
'json',
|
||||
'vue'
|
||||
],
|
||||
|
||||
modulePathIgnorePatterns: [
|
||||
'<rootDir>/tests/qunit/'
|
||||
],
|
||||
|
||||
// The paths to modules that run some code to configure or
|
||||
// set up the testing environment before each test
|
||||
setupFiles: [
|
||||
'./jest.setup.js'
|
||||
],
|
||||
|
||||
testEnvironment: 'jsdom',
|
||||
|
||||
transform: {
|
||||
}
|
||||
};
|
2
jest.setup.js
Normal file
2
jest.setup.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
'use strict';
|
||||
// In future we may want to define mw, or other globals here.
|
10330
package-lock.json
generated
10330
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -7,7 +7,8 @@
|
|||
"lint:js": "eslint --cache .",
|
||||
"lint:styles": "stylelint --cache --report-needless-disables **/*.{css,less}",
|
||||
"lint:i18n": "banana-checker --requireLowerCase=0 i18n/",
|
||||
"test": "npm run lint && npm run doc && dev-scripts/svg_check.sh",
|
||||
"test": "npm run lint && npm run doc && dev-scripts/svg_check.sh && npm run test:unit",
|
||||
"test:unit": "jest --silent --passWithNoTests",
|
||||
"minify:svg": "svgo --config=.svgo.config.js --quiet --recursive --folder resources/",
|
||||
"doc": "jsdoc -c jsdoc.json",
|
||||
"selenium-test-cucumber": "wdio tests/selenium/wdio.conf.cucumber.js",
|
||||
|
@ -30,5 +31,8 @@
|
|||
"stylelint-config-wikimedia": "0.16.1",
|
||||
"svgo": "3.2.0",
|
||||
"wdio-mediawiki": "2.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"jest": "^27.4.7"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue