Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix badge-maker package tests #10809

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading