Skip to content

Commit

Permalink
Revert "Migration jest => vitest (#4806)" (#4819)
Browse files Browse the repository at this point in the history
This reverts commit 97c2eb6.
  • Loading branch information
Shamzic authored Feb 3, 2025
1 parent 97c2eb6 commit 9e7fff4
Show file tree
Hide file tree
Showing 59 changed files with 12,202 additions and 11,396 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
env: {
node: true,
es2021: true,
jest: true,
},
extends: [
"eslint:recommended",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install dependencies
if: steps.restore-dependencies.outputs.cache-hit != 'true'
run: npm ci --prefer-offline --no-audit
- name: Vitest
- name: Jest
run: npm run test
deploy_equinoxe_production:
if: github.ref == 'refs/heads/main'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
echo "Waiting for OpenFisca to be ready..."
sleep 2
done
- name: Vitest
- name: Jest
run: npm run test
build:
name: Build
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ npm run serve

There are several levels of tests:

- Unit tests are executed by [Vitest](https://vitest.dev/) and run with `npm test`.
- Unit tests are executed by [Jest](https://jestjs.io/fr/) and run with `npm test`.
- End-to-end test are executed with [Cypress](https://www.cypress.io/) with `npm run cypress`

You can safely use `npm test && npm run cypress` to drive your developments.
Expand Down
7 changes: 2 additions & 5 deletions backend/lib/mes-aides/emails/email-render.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import fs from "fs"
import path from "path"
import consolidate from "consolidate"
import { fileURLToPath } from "url"

const mustache = consolidate.mustache
import config from "../../../config/index.js"
Expand All @@ -11,13 +10,11 @@ import { mjml } from "./index.js"
import { EmailType } from "../../../../lib/enums/messaging.js"
import { SurveyType } from "../../../../lib/enums/survey.js"

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const __dirname = new URL(".", import.meta.url).pathname

function readFile(filePath) {
return fs.readFileSync(path.resolve(__dirname, filePath), "utf8")
return fs.readFileSync(path.join(__dirname, filePath), "utf8")
}

const emailTemplate = readFile("templates/email.mjml")
const footerTemplate = readFile("templates/footer.mjml")
const headerTemplate = readFile("templates/header.mjml")
Expand Down
4 changes: 2 additions & 2 deletions backend/lib/smtp.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import config from "../config/index.js"
import nodemailer, { TransportOptions } from "nodemailer"
import nodemailer from "nodemailer"
import { Email } from "../../lib/types/email.js"

const transporter = nodemailer.createTransport(config.smtp as TransportOptions)
const transporter = nodemailer.createTransport(config.smtp)

export function sendEmailSmtp(email: Email) {
const { tags, ...emailParameters } = email
Expand Down
19 changes: 5 additions & 14 deletions data/all.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
import { existsSync } from "node:fs"
import base from "./index.js"
import jamstackLoader from "@betagouv/jamstack-loader"
import { Jamstack } from "./types/jamstack.d.js"
import path from "path"
import { fileURLToPath } from "url"

const __dirname = path.dirname(fileURLToPath(import.meta.url))
import { Jamstack } from "./types/jamstack.d.js"

let configFile = path.resolve(
__dirname,
"../contribuer/public/admin/config.yml"
)
const __dirname = new URL(".", import.meta.url).pathname
let configFile = path.join(__dirname, "../contribuer/public/admin/config.yml")
let jamstack: Jamstack

if (existsSync(configFile)) {
jamstack = jamstackLoader.get(configFile)
} else {
configFile = path.resolve(
__dirname,
"../../contribuer/public/admin/config.yml"
)
jamstack = jamstackLoader.get(configFile)
configFile = path.join(__dirname, "../../contribuer/public/admin/config.yml")
jamstack = jamstackLoader.get(`${configFile}`)
}

export default base.generate(jamstack)
6 changes: 2 additions & 4 deletions data/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import path from "path"
import yaml from "js-yaml"
import fs from "fs"
import { fileURLToPath } from "url"
import jamstackLoader from "@betagouv/jamstack-loader"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const __dirname = new URL(".", import.meta.url).pathname
const jamstack = jamstackLoader.get(
path.resolve(__dirname, "../contribuer/public/admin/config.yml")
path.join(__dirname, "../contribuer/public/admin/config.yml")
)

const typesMap = {
Expand Down
5 changes: 1 addition & 4 deletions iframes/iframes.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import path from "path"
import config from "../backend/config/index.js"
import webpack from "webpack"
import { fileURLToPath } from "url"

const __dirname = new URL(".", import.meta.url).pathname
process.env.BASE_URL = config.baseURL
process.env.IFRAME_TITLE = config.iframeTitle

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

export default {
mode: "production",
entry: {
Expand Down
Loading

0 comments on commit 9e7fff4

Please sign in to comment.