Skip to content

Commit 152b8e9

Browse files
authored
fix badge-maker package tests (#10809)
1 parent 954147f commit 152b8e9

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed
File renamed without changes.

badge-maker/lib/badge-cli.spec.mjs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
'use strict'
22

33
import path from 'path'
4+
import { fileURLToPath } from 'url'
45
import { spawn } from 'child-process-promise'
56
import { expect, use } from 'chai'
6-
use(require('sinon-chai'))
7+
import sinonChai from 'sinon-chai'
8+
use(sinonChai)
9+
10+
const dirName = path.dirname(fileURLToPath(import.meta.url))
711

812
function runCli(args) {
9-
return spawn('node', [path.join(__dirname, 'badge-cli.js'), ...args], {
13+
return spawn('node', [path.join(dirName, 'badge-cli.js'), ...args], {
1014
capture: ['stdout'],
1115
})
1216
}

badge-maker/lib/index.spec.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
import { expect } from 'chai'
4-
import { makeBadge, ValidationError } from '.'
4+
import { makeBadge, ValidationError } from './index.js'
55

66
describe('makeBadge function', function () {
77
it('should produce badge with valid input', async function () {

badge-maker/lib/make-badge.spec.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { test, given, forCases } from 'sazerac'
44
import { expect } from 'chai'
55
import snapshot from 'snap-shot-it'
66
import prettier from 'prettier'
7-
import makeBadge from './make-badge'
7+
import makeBadge from './make-badge.js'
88

99
async function expectBadgeToMatchSnapshot(format) {
1010
snapshot(await prettier.format(makeBadge(format), { parser: 'html' }))

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"danger": "danger",
8989
"test:e2e": "cypress run",
9090
"test:core": "cross-env TZ='UTC' NODE_CONFIG_ENV=test mocha \"core/**/*.spec.js\" \"lib/**/*.spec.js\" \"services/**/*.spec.js\"",
91-
"test:package": "mocha \"badge-maker/**/*.spec.js\"",
91+
"test:package": "mocha \"badge-maker/**/*.spec.@(mjs|js)\"",
9292
"test:entrypoint": "cross-env NODE_CONFIG_ENV=test mocha entrypoint.spec.js",
9393
"test:integration": "cross-env NODE_CONFIG_ENV=test mocha \"core/**/*.integration.js\" \"services/**/*.integration.js\"",
9494
"test:services": "cross-env NODE_CONFIG_ENV=test mocha core/service-test-runner/cli.js",

0 commit comments

Comments
 (0)