Skip to content

Commit 245ae22

Browse files
authored
Updating tests (#723)
* updating tests. This update gets our testing framework closer to what's needed when prettier v3 releases so changes when we start supporting v3 will be minimal. * latest changes from prettier next * adding the new dependencies preparing for prettier v3 and making sure they run with v2 * making sure to await the `expect` call
1 parent 6596e18 commit 245ae22

File tree

8 files changed

+655
-1931
lines changed

8 files changed

+655
-1931
lines changed

.c8rc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"check-coverage": true,
3+
"branches": 99,
4+
"lines": 100,
5+
"functions": 100,
6+
"statements": 100,
7+
"exclude": ["/node_modules/", "/scripts/", "/src/prettier-comments/"],
8+
"include": ["src/**/*.js", "!src/prettier-comments/**/*.js"],
9+
"reporter": ["lcov", "text"],
10+
"temp-dir": "./coverage/"
11+
}

jest.config.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,22 @@
1-
const FULL_TEST = Boolean(process.env.FULL_TEST);
21
const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE);
32

43
module.exports = {
5-
collectCoverage: FULL_TEST,
6-
collectCoverageFrom: [
7-
'scripts/**/*.js',
8-
'!scripts/generateIndexes.js',
9-
'src/**/*.js',
10-
'!<rootDir>/node_modules/',
11-
'!src/prettier-comments/**/*.js'
12-
],
13-
coverageDirectory: './coverage/',
14-
coveragePathIgnorePatterns: ['/node_modules/', '/scripts/'],
15-
coverageThreshold: {
16-
global: {
17-
branches: 100,
18-
functions: 100,
19-
lines: 100,
20-
statements: 100
21-
}
22-
},
234
moduleNameMapper: {
245
'^prettier$': TEST_STANDALONE
256
? '<rootDir>/node_modules/prettier/standalone'
267
: '<rootDir>/node_modules/prettier'
278
},
9+
runner: 'jest-light-runner',
2810
setupFiles: ['<rootDir>/tests/config/setup.js'],
2911
snapshotSerializers: [
3012
'jest-snapshot-serializer-raw',
3113
'jest-snapshot-serializer-ansi'
3214
],
3315
testEnvironment: 'node',
34-
testRegex: 'jsfmt\\.spec\\.js$|tests/unit/.*\\.js$',
16+
testMatch: [
17+
'<rootDir>/tests/format/**/jsfmt.spec.js',
18+
'<rootDir>/tests/unit/**/*.js'
19+
],
3520
transform: {},
3621
watchPlugins: [
3722
'jest-watch-typeahead/filename',

0 commit comments

Comments
 (0)