Skip to content

Commit 5e1e5b5

Browse files
committed
test(end-to-end): install dependencies in the proper order
1 parent b3abf95 commit 5e1e5b5

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

test/end-to-end/e2e-docs.test.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -908,10 +908,16 @@ module.exports = {
908908
});
909909
});
910910

911-
describe('[FULLY E2E] ./docs/getting-started.md', () => {
911+
describe('./docs/getting-started.md', () => {
912912
test('run through entire guide (programmatically) start to finish', async () => {
913913
expect.hasAssertions();
914914

915+
// * These tests will not work on Windows
916+
if (process.platform === 'win32') {
917+
expect(true).toBeTrue();
918+
return;
919+
}
920+
915921
const virtualTestCjsFile =
916922
/* js */ `const { makeRunner } = require('@black-flag/core/util');
917923
@@ -1081,14 +1087,6 @@ module.exports = bf.runProgram(path.join(__dirname, 'commands'));
10811087
}
10821088
);
10831089

1084-
// ! This pulls @black-flag/core from NPM (i.e. "fully end-to-end"). If
1085-
// ! we want to use the version from this repository, comment out this
1086-
// ! next command and copy node_modules from root instead.
1087-
await runYesRejectOnBadExit('npm', ['install', '@black-flag/core'], {
1088-
cwd: updatedRoot,
1089-
env: sharedRunEnv
1090-
});
1091-
10921090
await runYesRejectOnBadExit('mkdir', ['commands'], {
10931091
cwd: updatedRoot,
10941092
env: sharedRunEnv
@@ -1272,6 +1270,22 @@ module.exports = bf.runProgram(path.join(__dirname, 'commands'));
12721270
}
12731271
);
12741272

1273+
// ! This might pull @black-flag/core from NPM (i.e. "real end-to-end")
1274+
// ! depending on process.env.DO_REAL_E2E
1275+
// eslint-disable-next-line unicorn/prefer-ternary
1276+
if (process.env.DO_REAL_E2E) {
1277+
await runYesRejectOnBadExit('npm', ['install', '@black-flag/core'], {
1278+
cwd: updatedRoot,
1279+
env: sharedRunEnv
1280+
});
1281+
} else {
1282+
// * Otherwise, we use the pre-built local version of Black Flag
1283+
await fs.rename(
1284+
'node_modules/@black-flag',
1285+
toPath(updatedRoot, 'node_modules/@black-flag')
1286+
);
1287+
}
1288+
12751289
await runYesRejectOnBadExit('touch', ['test.cjs'], {
12761290
cwd: updatedRoot,
12771291
env: sharedRunEnv

0 commit comments

Comments
 (0)