Skip to content

Commit

Permalink
Merge pull request #218 from abcnews/fix-test-builds
Browse files Browse the repository at this point in the history
Fix test builds
  • Loading branch information
phocks committed Dec 6, 2023
2 parents da12ea0 + 8b5a6ca commit c1846d3
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Test using Node.js
uses: actions/setup-node@v4
with:
Expand Down
224 changes: 224 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"license": "MIT",
"contributors": [
"Colin Gourlay <gourlay.colin@abc.net.au>",
"Nathan Hoad <hoad.nathan@abc.net.au>",
"Simon Elvery <elvery.simon@abc.net.au>",
"Joshua Byrd <byrd.joshua@abc.net.au>"
"Joshua Byrd <byrd.joshua@abc.net.au>",
"Ash Kyd <kyd.ashley@abc.net.au>",
"Nathan Hoad"
],
"scripts": {
"postinstall": "node scripts/postinstall.js",
Expand Down Expand Up @@ -92,6 +93,7 @@
"yeoman-generator": "^5.2.0"
},
"devDependencies": {
"@types/jest": "^29.5.10",
"babel-eslint": "^10.1.0",
"eslint": "^7.7.0",
"eslint-config-prettier": "^8.2.0",
Expand Down
19 changes: 16 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { _testBuild } = require('../src/cli/build');
const { _testGenerate } = require('../src/cli/generate');
const path = require('path');
const fs = require('fs/promises');
const mem = require('mem');
const { execSync } = require('child_process');
const { getBuildConfig } = require('../src/config/build');
const { getBabelConfig } = require('../src/config/babel');
const { getProjectConfig } = require('../src/config/project');
Expand Down Expand Up @@ -53,6 +53,10 @@ beforeAll(async () => {
// Clean everything up
await rmRecursive(tempRoot);
await fs.mkdir(tempRoot);

// Link local aunty to global
const linkOutput = execSync('npm link');
console.log('Running: npm link', linkOutput.toString());
});

// Reset mocks
Expand Down Expand Up @@ -109,8 +113,17 @@ afterAll(async () => {
it('should build the generated project', async () => {
process.chdir(generatedProjectRoot);

// If the build fails for any reason this will throw.
await _testBuild(argv);
// execSync will throw on non-zero exit code

{
const output = execSync('npm link @abcnews/aunty');
console.log('Running: npm link @abcnews/aunty', output.toString());
}

{
const output = execSync('npx aunty build');
console.log('Running: npx aunty build', output.toString());
}

const fileList = await fs.readdir(path.join(generatedProjectRoot, '.aunty/build'));

Expand Down
2 changes: 1 addition & 1 deletion ts/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"verbatimModuleSyntax": true,
"verbatimModuleSyntax": false,
"resolveJsonModule": true,
"isolatedModules": true,
"strictNullChecks": true
Expand Down

0 comments on commit c1846d3

Please sign in to comment.