Skip to content

Commit df28fe3

Browse files
authored
Fix broken main test (#950)
* migrate to Yarn 3 * fix broken cache test * update CI node versions * pin node-preload to 0.2.0 Due to yarnpkg/berry#1841
1 parent 0b338e4 commit df28fe3

File tree

7 files changed

+1652
-914
lines changed

7 files changed

+1652
-914
lines changed

.github/workflows/ci.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ jobs:
2020
strategy:
2121
matrix:
2222
os: [ubuntu-latest, windows-latest]
23-
node-version: [10.x, 12.x, 14.x, 15.x]
23+
node-version: [12.x, 14.x, 16.x]
2424
webpack-version: [latest, '4']
2525
include:
26-
- node: 14.x
26+
- node-version: 18.x
27+
webpack-version: latest
2728
os: ubuntu-latest
2829
coverage: true
2930
runs-on: ${{ matrix.os }}
@@ -55,10 +56,10 @@ jobs:
5556
YARN_NODE_LINKER: node-modules
5657
steps:
5758
- uses: actions/checkout@v2
58-
- name: Use Node.js 14.x
59+
- name: Use Node.js latest
5960
uses: actions/setup-node@v1
6061
with:
61-
node-version: 14.x
62+
node-version: '*'
6263
- name: Install dependencies
6364
run: yarn
6465
- name: Install webpack 4

.yarn/releases/yarn-2.3.3.cjs

-55
This file was deleted.

.yarn/releases/yarn-3.2.3.cjs

+783
Large diffs are not rendered by default.

.yarnrc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
yarnPath: .yarn/releases/yarn-2.3.3.cjs
1+
yarnPath: .yarn/releases/yarn-3.2.3.cjs

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,8 @@
120120
"node ./scripts/yarn-install.js",
121121
"git add yarn.lock"
122122
]
123+
},
124+
"resolutions": {
125+
"nyc/node-preload": "0.2.0"
123126
}
124127
}

test/cache.test.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ const globalConfig = {
2727
},
2828
};
2929

30+
// Cache filename is either SHA256 or MD5 hash
31+
const UNCOMPRESSED_CACHE_FILE_REGEX = /^[0-9a-f]{32}(?:[0-9a-f]{32})?\.json$/;
32+
const CACHE_FILE_REGEX = /^[0-9a-f]{32}(?:[0-9a-f]{32})?\.json\.gz$/;
33+
3034
// Create a separate directory for each test so that the tests
3135
// can run in parallel
3236

@@ -109,7 +113,7 @@ test.serial.cb(
109113
t.deepEqual(stats.compilation.warnings, []);
110114

111115
fs.readdir(defaultCacheDir, (err, files) => {
112-
files = files.filter(file => /\b[0-9a-f]{5,40}\.json\.gz\b/.test(file));
116+
files = files.filter(file => CACHE_FILE_REGEX.test(file));
113117

114118
t.is(err, null);
115119
t.true(files.length > 0);
@@ -146,7 +150,7 @@ test.serial.cb(
146150
t.is(err, null);
147151

148152
fs.readdir(defaultCacheDir, (err, files) => {
149-
files = files.filter(file => /\b[0-9a-f]{5,40}\b/.test(file));
153+
files = files.filter(file => UNCOMPRESSED_CACHE_FILE_REGEX.test(file));
150154

151155
t.is(err, null);
152156
t.true(files.length > 0);
@@ -180,7 +184,7 @@ test.serial.cb(
180184
t.deepEqual(stats.compilation.warnings, []);
181185

182186
fs.readdir(defaultCacheDir, (err, files) => {
183-
files = files.filter(file => /\b[0-9a-f]{5,40}\.json\.gz\b/.test(file));
187+
files = files.filter(file => CACHE_FILE_REGEX.test(file));
184188

185189
t.is(err, null);
186190

0 commit comments

Comments
 (0)