Skip to content

Commit

Permalink
force color support in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed May 1, 2020
1 parent 1148a75 commit afe44c6
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 7 deletions.
15 changes: 14 additions & 1 deletion package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -23,7 +23,8 @@
"author": "Adam Baldwin",
"license": "ISC",
"dependencies": {
"chalk": "^4.0.0"
"chalk": "^4.0.0",
"require-inject": "^1.4.4"
},
"devDependencies": {
"tap": "^14.10.7"
Expand Down
18 changes: 17 additions & 1 deletion test/colors.js
@@ -1,5 +1,21 @@
const colors = require('../lib/colors.js')
const t = require('tap')
const requireInject = require('require-inject')
// force color support when in CI, so tests do the right thing
const cs = {
hasBasic: true,
has256: true,
has16m: true,
level: 3,
}
const colors = requireInject('../lib/colors.js', {
'chalk': requireInject('chalk', {
'supports-color': Object.assign(() => cs, {
stdout: cs,
stderr: cs,
})
})
})
t.formatSnapshot = ({report, exitCode}) => `${report}\nexitCode=${exitCode}`

t.test('with colors', async t => {
const c = colors(true)
Expand Down
17 changes: 16 additions & 1 deletion test/reporters/detail.js
@@ -1,6 +1,21 @@
const t = require('tap')
const fixture = require('../fixtures/index.js')
const Report = require('../..')
const requireInject = require('require-inject')
// force color support when in CI, so tests do the right thing
const cs = {
hasBasic: true,
has256: true,
has16m: true,
level: 3,
}
const Report = requireInject('../..', {
'chalk': requireInject('chalk', {
'supports-color': Object.assign(() => cs, {
stdout: cs,
stderr: cs,
})
})
})
t.formatSnapshot = ({report, exitCode}) => `${report}\nexitCode=${exitCode}`

for (const f of fixture.files) {
Expand Down
17 changes: 16 additions & 1 deletion test/reporters/install.js
@@ -1,6 +1,21 @@
const t = require('tap')
const fixture = require('../fixtures/index.js')
const Report = require('../..')
const requireInject = require('require-inject')
// force color support when in CI, so tests do the right thing
const cs = {
hasBasic: true,
has256: true,
has16m: true,
level: 3,
}
const Report = requireInject('../..', {
'chalk': requireInject('chalk', {
'supports-color': Object.assign(() => cs, {
stdout: cs,
stderr: cs,
})
})
})
t.formatSnapshot = ({report, exitCode}) => `${report}\nexitCode=${exitCode}`

for (const f of fixture.files) {
Expand Down
17 changes: 16 additions & 1 deletion test/reporters/json.js
@@ -1,6 +1,21 @@
const t = require('tap')
const fixture = require('../fixtures/index.js')
const Report = require('../..')
const requireInject = require('require-inject')
// force color support when in CI, so tests do the right thing
const cs = {
hasBasic: true,
has256: true,
has16m: true,
level: 3,
}
const Report = requireInject('../..', {
'chalk': requireInject('chalk', {
'supports-color': Object.assign(() => cs, {
stdout: cs,
stderr: cs,
})
})
})
t.formatSnapshot = ({report, exitCode}) => `${report}\nexitCode=${exitCode}`

for (const f of fixture.files) {
Expand Down
17 changes: 16 additions & 1 deletion test/reporters/quiet.js
@@ -1,6 +1,21 @@
const t = require('tap')
const fixture = require('../fixtures/index.js')
const Report = require('../..')
const requireInject = require('require-inject')
// force color support when in CI, so tests do the right thing
const cs = {
hasBasic: true,
has256: true,
has16m: true,
level: 3,
}
const Report = requireInject('../..', {
'chalk': requireInject('chalk', {
'supports-color': Object.assign(() => cs, {
stdout: cs,
stderr: cs,
})
})
})
t.formatSnapshot = ({report, exitCode}) => `${report}\nexitCode=${exitCode}`

for (const f of fixture.files) {
Expand Down

0 comments on commit afe44c6

Please sign in to comment.