Skip to content

Commit c3bec1b

Browse files
committed
wtfbbq
1 parent 75950e9 commit c3bec1b

File tree

3 files changed

+87
-2
lines changed

3 files changed

+87
-2
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
run: npm test
5252
env:
5353
CI: true
54+
NODE_OPTIONS: --no-warnings
5455

5556
- name: Notify
5657
uses: sarisia/actions-status-discord@v1

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"test": "npm run lint && npm run test:integration && npm run coverage",
1515
"test:nolint": "npm run test:integration && npm run coverage",
1616
"test:unit": "node --test 'test/unit/**/*-test.js'",
17-
"test:integration": "node --test test/integration/cli-test.js",
18-
"coverage": "node --test --experimental-test-coverage 'test/unit/**/*-test.js' test/integration/cli-test.js",
17+
"test:integration": "node test/integration/run.js",
18+
"coverage": "node --test --experimental-test-coverage 'test/unit/**/*-test.js'",
1919
"lint": "eslint . --fix",
2020
"rc": "npm version prerelease --preid RC"
2121
},

test/integration/run.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env node
2+
// Simple test runner that avoids Node.js test runner serialization issues
3+
let create = require('../../src/index')
4+
let { join, resolve } = require('path')
5+
let { readFileSync, existsSync, rmSync, mkdirSync } = require('fs')
6+
let { updater } = require('@architect/utils')
7+
8+
let tmp = resolve(__dirname, '..', 'tmp')
9+
let passed = 0
10+
let failed = 0
11+
12+
function emptyDirSync (dir) {
13+
if (existsSync(dir)) {
14+
rmSync(dir, { recursive: true, force: true })
15+
}
16+
mkdirSync(dir, { recursive: true })
17+
}
18+
19+
async function test (name, fn) {
20+
try {
21+
emptyDirSync(tmp)
22+
await fn()
23+
console.log(`✓ ${name}`)
24+
passed++
25+
}
26+
catch (err) {
27+
console.error(`✗ ${name}`)
28+
console.error(err)
29+
failed++
30+
}
31+
}
32+
33+
async function main () {
34+
console.log('Running CLI Integration Tests...\n')
35+
36+
await test('should build the basic templated node runtime project', async () => {
37+
let update = updater('Create')
38+
await create({ folder: tmp, install: false, runtime: 'node.js', update })
39+
if (!existsSync(join(tmp, 'src', 'http', 'get-index', 'index.mjs'))) {
40+
throw new Error('index.mjs not created')
41+
}
42+
if (!readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime node/)) {
43+
throw new Error('runtime node not in manifest')
44+
}
45+
})
46+
47+
await test('should build the basic templated deno runtime project', async () => {
48+
let update = updater('Create')
49+
await create({ folder: tmp, install: false, runtime: 'deno', update })
50+
if (!existsSync(join(tmp, 'src', 'http', 'get-index', 'mod.ts'))) {
51+
throw new Error('mod.ts not created')
52+
}
53+
if (!readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime deno/)) {
54+
throw new Error('runtime deno not in manifest')
55+
}
56+
})
57+
58+
await test('should build the basic templated python runtime project', async () => {
59+
let update = updater('Create')
60+
await create({ folder: tmp, install: false, runtime: 'python', update })
61+
if (!existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.py'))) {
62+
throw new Error('lambda.py not created')
63+
}
64+
if (!readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime python/)) {
65+
throw new Error('runtime python not in manifest')
66+
}
67+
})
68+
69+
await test('should build the basic templated ruby runtime project', async () => {
70+
let update = updater('Create')
71+
await create({ folder: tmp, install: false, runtime: 'ruby', update })
72+
if (!existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.rb'))) {
73+
throw new Error('lambda.rb not created')
74+
}
75+
if (!readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime ruby/)) {
76+
throw new Error('runtime ruby not in manifest')
77+
}
78+
})
79+
80+
console.log(`\n${passed} passed, ${failed} failed`)
81+
process.exit(failed > 0 ? 1 : 0)
82+
}
83+
84+
main()

0 commit comments

Comments
 (0)