Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,11 @@ jobs:
- name: Install
run: npm install

- name: Test (Node.js <= 16.x)
if: matrix.node-version <= '16.x'
run: npm run test:nolint
env:
CI: true

- name: Test
if: matrix.node-version > '16.x'
run: npm test
env:
CI: true
NODE_OPTIONS: --no-warnings

- name: Notify
uses: sarisia/actions-status-discord@v1
Expand Down
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

---

## [7.0.1] 2025-11-28

- Removed almost all devdeps in favour of node internal test runner/coverage

---

### [7.0.0] 2025-11-27

- Updated to >= node 22

---

## [6.0.0] 2024-09-24

### Changed
Expand Down
16 changes: 5 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@architect/create",
"version": "7.0.0",
"version": "7.0.1",
"description": "Idempotently initialize Architect projects",
"main": "src/index.js",
"bin": {
Expand All @@ -13,9 +13,9 @@
"scripts": {
"test": "npm run lint && npm run test:integration && npm run coverage",
"test:nolint": "npm run test:integration && npm run coverage",
"test:unit": "cross-env PORT=6666 tape 'test/unit/**/*-test.js' | tap-arc",
"test:integration": "cross-env tape 'test/integration/**/*-test.js' | tap-arc",
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
"test:unit": "node --test 'test/unit/**/*-test.js'",
"test:integration": "node test/integration/run.js",
"coverage": "node --test --experimental-test-coverage 'test/unit/**/*-test.js'",
"lint": "eslint . --fix",
"rc": "npm version prerelease --preid RC"
},
Expand All @@ -29,12 +29,6 @@
},
"devDependencies": {
"@architect/eslint-config": "~3.0.0",
"cross-env": "~10.0.0",
"eslint": "~9.36.0",
"fs-extra": "~11.3.2",
"nyc": "~17.1.0",
"proxyquire": "^2.1.3",
"tap-arc": "^1.2.2",
"tape": "~5.9.0"
"eslint": "~9.39.1"
}
}
120 changes: 68 additions & 52 deletions test/integration/cli-test.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,75 @@
let test = require('tape')
let cli = require('../../src/cli')
let { join } = require('path')
let fs = require('fs-extra')
let { readFileSync, existsSync } = require('fs')
let tmp = join(__dirname, '..', 'tmp')
let origCwd = process.cwd()
let argv = process.argv
let args = s => process.argv = [ 'fake-env', 'fake-file', ...s.split(' ') ]
let { describe, it, before, beforeEach } = require('node:test')
let assert = require('node:assert/strict')
let create = require('../../src/index')
let { join, resolve } = require('path')
let { readFileSync, existsSync, rmSync, mkdirSync } = require('fs')
let { updater } = require('@architect/utils')
let tmp = resolve(__dirname, '..', 'tmp')

test('integration test setup', async t => {
t.plan(1)
fs.emptyDirSync(tmp)
process.chdir(tmp)
t.pass('integration test environment setup complete')
})
// Helper to empty a directory (replaces fs-extra's emptyDirSync)
function emptyDirSync (dir) {
if (existsSync(dir)) {
rmSync(dir, { recursive: true, force: true })
}
mkdirSync(dir, { recursive: true })
}

test('should build the basic templated node runtime project', async t => {
t.plan(2)
fs.emptyDirSync(tmp)
args('--no-install --runtime node.js')
await cli()
t.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'index.mjs')), 'src/http/get-index/index.mjs created')
t.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime node/), '"runtime node" present somewhere in manifest')
})
describe('CLI Integration Tests', () => {
before(() => {
// Ensure tmp directory exists
emptyDirSync(tmp)
})

test('should build the basic templated deno runtime project', async t => {
t.plan(2)
fs.emptyDirSync(tmp)
args('--no-install --runtime deno')
await cli()
t.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'mod.ts')), 'src/http/get-index/mod.ts created')
t.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime deno/), '"runtime deno" present somewhere in manifest')
})
beforeEach(() => {
// Clean tmp directory before each test
emptyDirSync(tmp)
})

test('should build the basic templated python runtime project', async t => {
t.plan(2)
fs.emptyDirSync(tmp)
args('--no-install --runtime python')
await cli()
t.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.py')), 'src/http/get-index/lambda.py created')
t.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime python/), '"runtime python" present somewhere in manifest')
})
it('should build the basic templated node runtime project', async () => {
let update = updater('Create')
await create({
folder: tmp,
install: false,
runtime: 'node.js',
update,
})
assert.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'index.mjs')), 'src/http/get-index/index.mjs created')
assert.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime node/), '"runtime node" present somewhere in manifest')
})

test('should build the basic templated ruby runtime project', async t => {
t.plan(2)
fs.emptyDirSync(tmp)
args('--no-install --runtime ruby')
await cli()
t.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.rb')), 'src/http/get-index/lambda.rb created')
t.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime ruby/), '"runtime ruby" present somewhere in manifest')
})
it('should build the basic templated deno runtime project', async () => {
let update = updater('Create')
await create({
folder: tmp,
install: false,
runtime: 'deno',
update,
})
assert.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'mod.ts')), 'src/http/get-index/mod.ts created')
assert.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime deno/), '"runtime deno" present somewhere in manifest')
})

it('should build the basic templated python runtime project', async () => {
let update = updater('Create')
await create({
folder: tmp,
install: false,
runtime: 'python',
update,
})
assert.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.py')), 'src/http/get-index/lambda.py created')
assert.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime python/), '"runtime python" present somewhere in manifest')
})

test('integration test teardown', t => {
t.plan(1)
process.argv = argv
process.chdir(origCwd)
t.pass('integration test environment setup removed')
it('should build the basic templated ruby runtime project', async () => {
let update = updater('Create')
await create({
folder: tmp,
install: false,
runtime: 'ruby',
update,
})
assert.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.rb')), 'src/http/get-index/lambda.rb created')
assert.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime ruby/), '"runtime ruby" present somewhere in manifest')
})
})
84 changes: 84 additions & 0 deletions test/integration/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env node
// Simple test runner that avoids Node.js test runner serialization issues
let create = require('../../src/index')
let { join, resolve } = require('path')
let { readFileSync, existsSync, rmSync, mkdirSync } = require('fs')
let { updater } = require('@architect/utils')

let tmp = resolve(__dirname, '..', 'tmp')
let passed = 0
let failed = 0

function emptyDirSync (dir) {
if (existsSync(dir)) {
rmSync(dir, { recursive: true, force: true })
}
mkdirSync(dir, { recursive: true })
}

async function test (name, fn) {
try {
emptyDirSync(tmp)
await fn()
console.log(`✓ ${name}`)
passed++
}
catch (err) {
console.error(`✗ ${name}`)
console.error(err)
failed++
}
}

async function main () {
console.log('Running CLI Integration Tests...\n')

await test('should build the basic templated node runtime project', async () => {
let update = updater('Create')
await create({ folder: tmp, install: false, runtime: 'node.js', update })
if (!existsSync(join(tmp, 'src', 'http', 'get-index', 'index.mjs'))) {
throw new Error('index.mjs not created')
}
if (!readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime node/)) {
throw new Error('runtime node not in manifest')
}
})

await test('should build the basic templated deno runtime project', async () => {
let update = updater('Create')
await create({ folder: tmp, install: false, runtime: 'deno', update })
if (!existsSync(join(tmp, 'src', 'http', 'get-index', 'mod.ts'))) {
throw new Error('mod.ts not created')
}
if (!readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime deno/)) {
throw new Error('runtime deno not in manifest')
}
})

await test('should build the basic templated python runtime project', async () => {
let update = updater('Create')
await create({ folder: tmp, install: false, runtime: 'python', update })
if (!existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.py'))) {
throw new Error('lambda.py not created')
}
if (!readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime python/)) {
throw new Error('runtime python not in manifest')
}
})

await test('should build the basic templated ruby runtime project', async () => {
let update = updater('Create')
await create({ folder: tmp, install: false, runtime: 'ruby', update })
if (!existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.rb'))) {
throw new Error('lambda.rb not created')
}
if (!readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime ruby/)) {
throw new Error('runtime ruby not in manifest')
}
})

console.log(`\n${passed} passed, ${failed} failed`)
process.exit(failed > 0 ? 1 : 0)
}

main()
Loading