Skip to content

Commit 2d4aa47

Browse files
authored
fix: add test scripts to sample snap (#20)
* fix: add test scripts to sample snap * update yarn constraints
1 parent 381ba82 commit 2d4aa47

2 files changed

Lines changed: 28 additions & 31 deletions

File tree

packages/sample-snap/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
"prepublishOnly": "mm-snap manifest",
4141
"serve": "mm-snap serve",
4242
"start": "mm-snap watch",
43-
"test": "jest",
43+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
44+
"test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
45+
"test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
46+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch",
4447
"since-latest-release": "../../scripts/since-latest-release.sh"
4548
},
4649
"dependencies": {

yarn.config.cjs

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -200,39 +200,33 @@ module.exports = defineConfig({
200200
'../../scripts/since-latest-release.sh',
201201
);
202202

203-
if (isSnap) {
204-
// Snap packages need `jest` available but typically use
205-
// `@metamask/snaps-jest`; the script wording is left to each snap.
206-
expectWorkspaceField(workspace, 'scripts.test');
207-
} else {
208-
// All non-root packages must have the same "test" script.
209-
expectWorkspaceField(
210-
workspace,
211-
'scripts.test',
212-
'NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter',
213-
);
203+
// All non-root packages must have the same "test" script.
204+
expectWorkspaceField(
205+
workspace,
206+
'scripts.test',
207+
'NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter',
208+
);
214209

215-
// All non-root packages must have the same "test:clean" script.
216-
expectWorkspaceField(
217-
workspace,
218-
'scripts.test:clean',
219-
'NODE_OPTIONS=--experimental-vm-modules jest --clearCache',
220-
);
210+
// All non-root packages must have the same "test:clean" script.
211+
expectWorkspaceField(
212+
workspace,
213+
'scripts.test:clean',
214+
'NODE_OPTIONS=--experimental-vm-modules jest --clearCache',
215+
);
221216

222-
// All non-root packages must have the same "test:verbose" script.
223-
expectWorkspaceField(
224-
workspace,
225-
'scripts.test:verbose',
226-
'NODE_OPTIONS=--experimental-vm-modules jest --verbose',
227-
);
217+
// All non-root packages must have the same "test:verbose" script.
218+
expectWorkspaceField(
219+
workspace,
220+
'scripts.test:verbose',
221+
'NODE_OPTIONS=--experimental-vm-modules jest --verbose',
222+
);
228223

229-
// All non-root packages must have the same "test:watch" script.
230-
expectWorkspaceField(
231-
workspace,
232-
'scripts.test:watch',
233-
'NODE_OPTIONS=--experimental-vm-modules jest --watch',
234-
);
235-
}
224+
// All non-root packages must have the same "test:watch" script.
225+
expectWorkspaceField(
226+
workspace,
227+
'scripts.test:watch',
228+
'NODE_OPTIONS=--experimental-vm-modules jest --watch',
229+
);
236230
}
237231

238232
if (isChildWorkspace) {

0 commit comments

Comments
 (0)