Skip to content

Commit

Permalink
chore(deps): update dependency chai to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
ext committed Apr 6, 2024
1 parent bc822c5 commit b7645ef
Show file tree
Hide file tree
Showing 21 changed files with 129 additions and 295 deletions.
15 changes: 14 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ module.exports = {
extends: ["@forsakringskassan/typescript"],
},
{
files: "*.spec.[jt]s",
files: "*.mjs",
rules: {
"import/extensions": [
"error",
"never",
{
json: "always",
mjs: "always",
},
],
},
},
{
files: "*.spec.mjs",
env: {
mocha: true,
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Prettier
run: npm run prettier:check
- name: Mocha
run: npm exec mocha -- --exit "test/**/*.js"
run: npm exec mocha -- --exit "test/**/*.spec.mjs"
- name: Build
run: |
npm run --if-present build
Expand Down
148 changes: 55 additions & 93 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"pretest": "run-s prettier:check eslint",
"test": "mocha --exit test/**/*.js"
"test": "mocha --exit test/**/*.spec.mjs"
},
"prettier": "@forsakringskassan/prettier-config",
"release": {
Expand All @@ -46,7 +46,7 @@
"@forsakringskassan/eslint-config-cli": "10.3.0",
"@forsakringskassan/eslint-config-typescript": "10.3.0",
"@forsakringskassan/prettier-config": "1.4.0",
"chai": "4.4.1",
"chai": "5.1.0",
"express": "4.19.2",
"mocha": "10.4.0",
"npm-pkg-lint": "2.2.0",
Expand Down
9 changes: 6 additions & 3 deletions test-server.js → test-server.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const express = require("express");
const mock = require("./main");
import express from "express";

/* eslint-disable-next-line import/extensions -- esm requires extension */
import mock from "./main.js";

const app = express();

Expand All @@ -21,5 +23,6 @@ const server = app.listen(0, function () {
const addr = server.address();
console.log("Example app listening at port", addr.port);
});
const hostname = `localhost:${server.address().port}`;

module.exports = server;
export { server, hostname };
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
const chai = require("chai");

const expect = chai.expect;
const request = require("request");
import { expect } from "chai";
import request from "request";
import { hostname } from "../../test-server.mjs";

describe("Advanced mockformat", function () {
let server;
let hostname;

before(function () {
server = require("./../../test-server");
hostname = `localhost:${server.address().port}`;
});

describe("Bodyparameter", function () {
it("Should return the response for the first bodyparamter match", function (done) {
const requestbody = { foo: "foo" };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
const chai = require("chai");

const expect = chai.expect;
const request = require("request");
import { expect } from "chai";
import request from "request";
import { hostname } from "../../test-server.mjs";

describe("Advanced mockformat", function () {
let server;
let hostname;

before(function () {
server = require("./../../test-server");
hostname = `localhost:${server.address().port}`;
});

describe("Cookies", function () {
it("Should return the response for the first cookie match", function (done) {
const headers = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
const chai = require("chai");

const expect = chai.expect;
const request = require("request");
import { expect } from "chai";
import request from "request";
import { hostname } from "../../test-server.mjs";

describe("Advanced mockformat", function () {
let server;
let hostname;

before(function () {
server = require("./../../test-server");
hostname = `localhost:${server.address().port}`;
});

const DELAY_TIME = 1000;

describe("Delay", function () {
Expand Down
Loading

0 comments on commit b7645ef

Please sign in to comment.