Skip to content

Commit

Permalink
move fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Apr 8, 2022
1 parent c5ce030 commit 41e8395
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 16 deletions.
7 changes: 3 additions & 4 deletions smoke-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@
"url": "https://github.com/npm/cli.git",
"directory": "smoke-tests"
},
"dependencies": {
"minify-registry-metadata": "^2.2.0"
},
"devDependencies": {
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/promise-spawn": "^3.0.0",
"@npmcli/template-oss": "3.3.2",
"minify-registry-metadata": "^2.2.0",
"rimraf": "^3.0.2",
"tap": "^16.0.1",
"which": "^2.0.2"
Expand All @@ -38,7 +36,8 @@
"workspaceRepo": false
},
"tap": {
"no-coverage": true
"no-coverage": true,
"files": "test/index.js"
},
"files": [
"bin/",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 11 additions & 12 deletions smoke-tests/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { join, resolve, sep } = require('path')
const t = require('tap')
const rimraf = require('rimraf')
const which = require('which').sync
const { start, stop, registry } = require('../lib/server.js')
const { start, stop, registry } = require('./fixtures/server.js')

const { SMOKE_PUBLISH_NPM, CI, PATH } = process.env
const log = CI ? console.error : () => {}
Expand All @@ -14,6 +14,16 @@ const npmCli = join('bin', 'npm-cli.js')
const execArgv = SMOKE_PUBLISH_NPM ? ['npm'] : [process.execPath, join(cwd, npmCli)]
const npmDir = SMOKE_PUBLISH_NPM ? realpathSync(which('npm')).replace(sep + npmCli, '') : cwd

// setup server
t.before(start)
t.teardown(stop)
// update notifier should never be written
t.afterEach((t) => {
const updateExists = existsSync(join(cacheLocation, '_update-notifier-last-checked'))
t.equal(updateExists, false)
})

const readFile = filename => readFileSync(resolve(localPrefix, filename), 'utf-8')
const normalizePath = path => path.replace(/[A-Z]:/, '').replace(/\\/g, '/')

t.cleanSnapshot = s =>
Expand Down Expand Up @@ -92,17 +102,6 @@ const exec = async (...args) => {
return res.stdout
}

const readFile = filename => readFileSync(resolve(localPrefix, filename), 'utf-8')

// setup server
t.before(start)
t.teardown(stop)
// update notifier should never be written
t.afterEach((t) => {
const updateExists = existsSync(join(cacheLocation, '_update-notifier-last-checked'))
t.equal(updateExists, false)
})

// this test must come first, its package.json will be destroyed and the one
// created in the next test (npm init) will create a new one that must be
// present for later tests
Expand Down

0 comments on commit 41e8395

Please sign in to comment.