Skip to content

Commit

Permalink
fix badge-maker package tests (badges#10809)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s authored Jan 18, 2025
1 parent 954147f commit 152b8e9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
File renamed without changes.
8 changes: 6 additions & 2 deletions badge-maker/lib/badge-cli.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
'use strict'

import path from 'path'
import { fileURLToPath } from 'url'
import { spawn } from 'child-process-promise'
import { expect, use } from 'chai'
use(require('sinon-chai'))
import sinonChai from 'sinon-chai'
use(sinonChai)

const dirName = path.dirname(fileURLToPath(import.meta.url))

function runCli(args) {
return spawn('node', [path.join(__dirname, 'badge-cli.js'), ...args], {
return spawn('node', [path.join(dirName, 'badge-cli.js'), ...args], {
capture: ['stdout'],
})
}
Expand Down
2 changes: 1 addition & 1 deletion badge-maker/lib/index.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

import { expect } from 'chai'
import { makeBadge, ValidationError } from '.'
import { makeBadge, ValidationError } from './index.js'

describe('makeBadge function', function () {
it('should produce badge with valid input', async function () {
Expand Down
2 changes: 1 addition & 1 deletion badge-maker/lib/make-badge.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { test, given, forCases } from 'sazerac'
import { expect } from 'chai'
import snapshot from 'snap-shot-it'
import prettier from 'prettier'
import makeBadge from './make-badge'
import makeBadge from './make-badge.js'

async function expectBadgeToMatchSnapshot(format) {
snapshot(await prettier.format(makeBadge(format), { parser: 'html' }))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"danger": "danger",
"test:e2e": "cypress run",
"test:core": "cross-env TZ='UTC' NODE_CONFIG_ENV=test mocha \"core/**/*.spec.js\" \"lib/**/*.spec.js\" \"services/**/*.spec.js\"",
"test:package": "mocha \"badge-maker/**/*.spec.js\"",
"test:package": "mocha \"badge-maker/**/*.spec.@(mjs|js)\"",
"test:entrypoint": "cross-env NODE_CONFIG_ENV=test mocha entrypoint.spec.js",
"test:integration": "cross-env NODE_CONFIG_ENV=test mocha \"core/**/*.integration.js\" \"services/**/*.integration.js\"",
"test:services": "cross-env NODE_CONFIG_ENV=test mocha core/service-test-runner/cli.js",
Expand Down

0 comments on commit 152b8e9

Please sign in to comment.