Skip to content

Commit

Permalink
redo tests, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
nexdrew committed Aug 15, 2019
1 parent fc4869a commit a3c3189
Show file tree
Hide file tree
Showing 31 changed files with 445 additions and 214 deletions.
7 changes: 1 addition & 6 deletions .gitignore
@@ -1,9 +1,4 @@
package-lock.json
node_modules/
.nyc_output/
test/fixture/.next/
test/fixture/nextoutput/
test/fixture/next.config.js
test/fixture2/.next/BUILD_ID
test/fixture-next5/build/
test/fixture-next6/.next/
.next/
13 changes: 7 additions & 6 deletions package.json
Expand Up @@ -8,7 +8,7 @@
],
"scripts": {
"pretest": "standard",
"test": "tap --cov test/test*.js",
"test": "tap --cov --timeout=180 test/test-next6.js test/test-next7.js test/test-next8.js test/test-next9.js",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"release": "standard-version"
},
Expand Down Expand Up @@ -38,10 +38,11 @@
"homepage": "https://github.com/nexdrew/next-build-id#readme",
"dependencies": {},
"devDependencies": {
"coveralls": "^3.0.1",
"rimraf": "^2.6.2",
"standard": "^13.0.1",
"standard-version": "^6.0.1",
"tap": "^12.0.1"
"coveralls": "^3.0.6",
"rimraf": "^3.0.0",
"standard": "^13.1.0",
"standard-version": "^7.0.0",
"sywac": "^1.2.2",
"tap": "^14.6.1"
}
}
1 change: 1 addition & 0 deletions test/fixture-next6/dotgit/HEAD
@@ -0,0 +1 @@
ref: refs/heads/master
1 change: 1 addition & 0 deletions test/fixture-next6/dotgit/refs/heads/master
@@ -0,0 +1 @@
0123456789abcdef0123456789abcdef0123fff6
7 changes: 4 additions & 3 deletions test/fixture-next6/next.config.js
@@ -1,8 +1,9 @@
const nextBuildId = require('../../index')

module.exports = (phase, nextConfig) => {
if (process.env.NBI_TEST_CALL_DEFAULT_GENERATEBUILDID) console.log(nextConfig.defaultConfig.generateBuildId())
module.exports = () => {
const opts = { dir: __dirname }
if (process.env.NBI_TEST_DESCRIBE) opts.describe = true
return {
generateBuildId: () => nextBuildId({ dir: __dirname }).then(result => result.id)
generateBuildId: () => process.env.NBI_TEST_SYNC ? nextBuildId.sync(opts) : nextBuildId(opts)
}
}
2 changes: 1 addition & 1 deletion test/fixture-next6/package.json
Expand Up @@ -10,7 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"next": "^6.0.3",
"next": "^6.1.2",
"react": "^16.4.0",
"react-dom": "^16.4.0"
}
Expand Down
1 change: 1 addition & 0 deletions test/fixture-next7/dotgit/HEAD
@@ -0,0 +1 @@
ref: refs/heads/master
1 change: 1 addition & 0 deletions test/fixture-next7/dotgit/refs/heads/master
@@ -0,0 +1 @@
0123456789abcdef0123456789abcdef0123fff7
9 changes: 9 additions & 0 deletions test/fixture-next7/next.config.js
@@ -0,0 +1,9 @@
const nextBuildId = require('../../index')

module.exports = () => {
const opts = { dir: __dirname }
if (process.env.NBI_TEST_DESCRIBE) opts.describe = true
return {
generateBuildId: () => process.env.NBI_TEST_SYNC ? nextBuildId.sync(opts) : nextBuildId(opts)
}
}
8 changes: 4 additions & 4 deletions test/fixture/package.json → test/fixture-next7/package.json
@@ -1,7 +1,7 @@
{
"name": "fixture",
"version": "1.0.0",
"description": "Fixture web app, don't worry about it",
"description": "Fixture to test against Next.js 7",
"private": true,
"main": "index.js",
"scripts": {
Expand All @@ -10,8 +10,8 @@
"author": "",
"license": "ISC",
"dependencies": {
"next": "^4.2.3",
"react": "^16.3.1",
"react-dom": "^16.3.1"
"next": "^7.0.3",
"react": "^16.0.0",
"react-dom": "^16.0.0"
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions test/fixture-next8/dotgit/HEAD
@@ -0,0 +1 @@
ref: refs/heads/master
1 change: 1 addition & 0 deletions test/fixture-next8/dotgit/refs/heads/master
@@ -0,0 +1 @@
0123456789abcdef0123456789abcdef0123fff8
9 changes: 9 additions & 0 deletions test/fixture-next8/next.config.js
@@ -0,0 +1,9 @@
const nextBuildId = require('../../index')

module.exports = () => {
const opts = { dir: __dirname }
if (process.env.NBI_TEST_DESCRIBE) opts.describe = true
return {
generateBuildId: () => process.env.NBI_TEST_SYNC ? nextBuildId.sync(opts) : nextBuildId(opts)
}
}
17 changes: 17 additions & 0 deletions test/fixture-next8/package.json
@@ -0,0 +1,17 @@
{
"name": "fixture",
"version": "1.0.0",
"description": "Fixture to test against Next.js 8",
"private": true,
"main": "index.js",
"scripts": {
"build": "next build"
},
"author": "",
"license": "ISC",
"dependencies": {
"next": "^8.1.0",
"react": "^16.6.0",
"react-dom": "^16.6.0"
}
}
1 change: 1 addition & 0 deletions test/fixture-next8/pages/index.js
@@ -0,0 +1 @@
export default () => <div>Welcome to next.js!</div>
1 change: 1 addition & 0 deletions test/fixture-next9/dotgit/HEAD
@@ -0,0 +1 @@
ref: refs/heads/master
1 change: 1 addition & 0 deletions test/fixture-next9/dotgit/refs/heads/master
@@ -0,0 +1 @@
0123456789abcdef0123456789abcdef0123fff9
9 changes: 9 additions & 0 deletions test/fixture-next9/next.config.js
@@ -0,0 +1,9 @@
const nextBuildId = require('../../index')

module.exports = () => {
const opts = { dir: __dirname }
if (process.env.NBI_TEST_DESCRIBE) opts.describe = true
return {
generateBuildId: () => process.env.NBI_TEST_SYNC ? nextBuildId.sync(opts) : nextBuildId(opts)
}
}
17 changes: 17 additions & 0 deletions test/fixture-next9/package.json
@@ -0,0 +1,17 @@
{
"name": "fixture",
"version": "1.0.0",
"description": "Fixture to test against Next.js 9",
"private": true,
"main": "index.js",
"scripts": {
"build": "next build"
},
"author": "",
"license": "ISC",
"dependencies": {
"next": "^9.0.3",
"react": "^16.9.0",
"react-dom": "^16.9.0"
}
}
1 change: 1 addition & 0 deletions test/fixture-next9/pages/index.js
@@ -0,0 +1 @@
export default () => <div>Welcome to next.js!</div>
Empty file.
Empty file removed test/fixture3/.next/BUILD_ID
Empty file.
Empty file.
7 changes: 4 additions & 3 deletions test/git
@@ -1,12 +1,13 @@
#!/usr/bin/env node

// --git-dir=${inputDir}/.git --work-tree=${inputDir}
// rev-parse HEAD
// describe --tags
require('sywac')
.dir('--git-dir <dir>', { mustExist: true })
.dir('--work-tree <dir>', { mustExist: true })
.outputSettings({ showHelpOnError: false })
.parseAndExit()
.then(argv => {
if (!process.env.NBI_TEST_FIXTURE || !String(process.env.NBI_TEST_FIXTURE).includes('fixture3')) {
console.log('0123456789abcdef0123456789abcdef01234567')
}
console.log(argv._[0] === 'describe' ? 'v2.0.1-12-g0123456' : '0123456789abcdef0123456789abcdef01234567')
})
126 changes: 0 additions & 126 deletions test/test-fixture.js

This file was deleted.

0 comments on commit a3c3189

Please sign in to comment.