Skip to content

Commit a007e2a

Browse files
authored
fix!: update dependencies, including jest (#335)
BREAKING CHANGE: Jest updated from v27 to v28 Fixes #319
1 parent bcece32 commit a007e2a

File tree

6 files changed

+1035
-1359
lines changed

6 files changed

+1035
-1359
lines changed

package.json

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,32 @@
3232
"release:publish": "npm publish --access public --registry=https://registry.npmjs.org",
3333
"test": "jest"
3434
},
35-
"//": {
36-
"chalk": "Cannot update to [email protected] because it requires ESM adoption https://github.com/chalk/chalk/releases/tag/v5.0.0"
37-
},
3835
"dependencies": {
39-
"@lwc/compiler": "3.0.1",
40-
"@lwc/engine-dom": "3.0.1",
41-
"@lwc/engine-server": "2.49.1",
42-
"@lwc/jest-preset": "12.0.3",
43-
"@lwc/jest-resolver": "12.0.3",
44-
"@lwc/jest-serializer": "12.0.3",
45-
"@lwc/jest-transformer": "12.0.3",
46-
"@lwc/module-resolver": "3.0.1",
47-
"@lwc/synthetic-shadow": "3.0.1",
48-
"@lwc/wire-service": "3.0.1",
36+
"@lwc/compiler": "3.1.3",
37+
"@lwc/engine-dom": "3.1.3",
38+
"@lwc/engine-server": "3.1.3",
39+
"@lwc/jest-preset": "13.0.0",
40+
"@lwc/jest-resolver": "13.0.0",
41+
"@lwc/jest-serializer": "13.0.0",
42+
"@lwc/jest-transformer": "13.0.0",
43+
"@lwc/module-resolver": "3.1.3",
44+
"@lwc/synthetic-shadow": "3.1.3",
45+
"@lwc/wire-service": "3.1.3",
4946
"@salesforce/wire-service-jest-util": "4.0.1",
50-
"chalk": "^4.1.2",
51-
"fast-glob": "^3.2.12",
52-
"jest": "27.4.7",
47+
"fast-glob": "^3.3.1",
48+
"jest": "29.6.2",
49+
"jest-environment-jsdom": "29.6.2",
5350
"yargs": "~17.7.2"
5451
},
5552
"devDependencies": {
56-
"@babel/core": "^7.22.5",
57-
"@babel/eslint-parser": "^7.22.5",
58-
"@babel/plugin-proposal-decorators": "^7.22.5",
59-
"eslint": "^8.43.0",
53+
"@babel/core": "^7.22.10",
54+
"@babel/eslint-parser": "^7.22.10",
55+
"@babel/plugin-proposal-decorators": "^7.22.10",
56+
"eslint": "^8.46.0",
6057
"husky": "^8.0.3",
6158
"isbinaryfile": "^5.0.0",
62-
"lint-staged": "^13.2.2",
63-
"prettier": "^2.8.8"
59+
"lint-staged": "^13.2.3",
60+
"prettier": "^3.0.1"
6461
},
6562
"lint-staged": {
6663
"*.js": "eslint",

src/config.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@ const { PROJECT_ROOT, getModulePaths } = require('./utils/project.js');
1212

1313
function getCoveragePaths() {
1414
const modulePaths = getModulePaths();
15-
return modulePaths.map((p) => {
16-
// convert back to forward slashes here on Windows for Jest to be happy
17-
return p.replace(/\\/g, '/') + '/**/*.js';
18-
});
15+
return modulePaths
16+
.map((p) => {
17+
// convert back to forward slashes here on Windows for Jest to be happy
18+
const prefix = p.replace(/\\/g, '/');
19+
return [
20+
// Note no `*.js` here - Jest will not find `.js` files unless you use a bare `*`
21+
prefix + '/**/*',
22+
// Specifically exclude HTML/CSS files since Jest doesn't understand the syntax
23+
'!' + prefix + '/**/*.html',
24+
'!' + prefix + '/**/*.css',
25+
];
26+
})
27+
.flat();
1928
}
2029

2130
const jestConfig = {

src/log.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,22 @@
88

99
/* eslint-disable no-console */
1010

11-
const chalk = require('chalk');
11+
function blue(message) {
12+
// equivalent to chalk.blue()
13+
return `\x1B[34m${message}\x1B[39m`;
14+
}
15+
16+
function red(message) {
17+
// equivalent to chalk.red()
18+
return `\x1B[31m${message}\x1B[39m`;
19+
}
1220

1321
function info(message) {
14-
console.log(`${chalk.blue('info')} ${message}`);
22+
console.log(`${blue('info')} ${message}`);
1523
}
1624

1725
function error(message) {
18-
console.error(`${chalk.red('error')} ${message}`);
26+
console.error(`${red('error')} ${message}`);
1927
}
2028

2129
module.exports = {

tests/__snapshots__/help.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Options:
1616
--debug Run tests in debug mode
1717
(https://jestjs.io/docs/en/troubleshooting)
1818
[boolean] [default: false]
19-
--skipApiVersionCheck Disable the \\"sourceApiVersion\\" field check before
19+
--skipApiVersionCheck Disable the "sourceApiVersion" field check before
2020
running tests. **Warning** By disabling this check
2121
you risk running tests against stale versions of
2222
the framework. See details here:

tests/config.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ const { jestConfig } = require('../src/config');
1111

1212
test('coveragePaths correctly build', () => {
1313
expect(jestConfig.collectCoverageFrom).toStrictEqual([
14-
'force-app/main/unix/lwc/**/*.js',
15-
'force-app/main/windows/lwc/**/*.js',
14+
'force-app/main/unix/lwc/**/*',
15+
'!force-app/main/unix/lwc/**/*.html',
16+
'!force-app/main/unix/lwc/**/*.css',
17+
'force-app/main/windows/lwc/**/*',
18+
'!force-app/main/windows/lwc/**/*.html',
19+
'!force-app/main/windows/lwc/**/*.css',
1620
]);
1721
});

0 commit comments

Comments
 (0)