Skip to content

Commit c331426

Browse files
committed
test: use more robust existence check when attempting to access distributables
1 parent 62cd846 commit c331426

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

test/integration/integration-node-interop.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
// * environments, (2) using modern vs modern-default vs default vs dot-default
66
// * import syntax, (3) using main vs pure import specifiers.
77

8+
import { existsSync } from 'node:fs';
89
import debugFactory from 'debug';
910
import mergeWith from 'lodash.mergewith';
1011

1112
import { name as pkgName, exports as pkgExports } from '../../package.json';
12-
import { run, withMockedFixture } from '../setup';
13+
import { withMockedFixture } from '../setup';
1314
import { assets } from './assets';
1415

1516
import {
@@ -32,12 +33,12 @@ debug('IMPORT_SPECIFIERS_UNDER_TEST: %O', IMPORT_SPECIFIERS_UNDER_TEST);
3233
debug('IMPORT_STYLES_UNDER_TEST: %O', IMPORT_STYLES_UNDER_TEST);
3334

3435
beforeAll(async () => {
35-
if ((await run('test', ['-e', pkgMainPath])).code != 0) {
36+
if (!existsSync(pkgMainPath)) {
3637
debug(`unable to find main export: ${pkgMainPath}`);
3738
throw new Error('must build distributables first (try `npm run build-dist`)');
3839
}
3940

40-
if ((await run('test', ['-e', pkgPurePath])).code != 0) {
41+
if (!existsSync(pkgPurePath)) {
4142
debug(`unable to find pure export: ${pkgPurePath}`);
4243
throw new Error('must build distributables first (try `npm run build-dist`)');
4344
}

test/integration/integration-node-smoke.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
// * (3) with the feature set we claim and interoperability code given in the
77
// * documentation.
88

9+
import { existsSync } from 'node:fs';
910
import debugFactory from 'debug';
1011
import mergeWith from 'lodash.mergewith';
1112

1213
import { name as pkgName, exports as pkgExports } from '../../package.json';
13-
import { run, withMockedFixture } from '../setup';
14+
import { withMockedFixture } from '../setup';
1415
import { assets } from './assets';
1516

1617
import {
@@ -31,12 +32,12 @@ debug('FRAMEWORKS_UNDER_TEST: %O', FRAMEWORKS_UNDER_TEST);
3132
debug('BABEL_VERSIONS_UNDER_TEST: %O', BABEL_VERSIONS_UNDER_TEST);
3233

3334
beforeAll(async () => {
34-
if ((await run('test', ['-e', pkgMainPath])).code != 0) {
35+
if (!existsSync(pkgMainPath)) {
3536
debug(`unable to find main export: ${pkgMainPath}`);
3637
throw new Error('must build distributables first (try `npm run build-dist`)');
3738
}
3839

39-
if ((await run('test', ['-e', pkgPurePath])).code != 0) {
40+
if (!existsSync(pkgPurePath)) {
4041
debug(`unable to find pure export: ${pkgPurePath}`);
4142
throw new Error('must build distributables first (try `npm run build-dist`)');
4243
}

0 commit comments

Comments
 (0)