Merge pull request #13302 from Budibase/tests/shared-core-ci

Tests/shared core ci
This commit is contained in:
Adria Navarro 2024-03-20 12:34:02 +01:00 committed by GitHub
commit a75cdb78b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 28 additions and 50 deletions

@ -1 +1 @@
Subproject commit d68b4f40f85dba3184da8b9d63ef2cd66d4a8ef2
Subproject commit 8baf8586ec078951230c8466d5f13f9b6d5ed055

View File

@ -0,0 +1,10 @@
export default {
preset: "ts-jest",
testEnvironment: "node",
transform: {
"^.+\\.ts?$": "@swc/jest",
},
moduleNameMapper: {
"@budibase/types": "<rootDir>/../types/src",
},
}

View File

@ -11,7 +11,9 @@
"build": "node ../../scripts/build.js && tsc -p tsconfig.build.json --emitDeclarationOnly --paths null",
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
"dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
"check:types": "tsc -p tsconfig.json --noEmit --paths null"
"check:types": "tsc -p tsconfig.json --noEmit --paths null",
"test": "jest",
"test:watch": "yarn test --watchAll"
},
"dependencies": {
"@budibase/types": "0.0.0",
@ -20,29 +22,5 @@
"devDependencies": {
"rimraf": "3.0.2",
"typescript": "5.2.2"
},
"nx": {
"targets": {
"build": {
"dependsOn": [
{
"projects": [
"@budibase/types"
],
"target": "build"
}
]
},
"dev": {
"dependsOn": [
{
"projects": [
"@budibase/types"
],
"target": "build"
}
]
}
}
}
}

View File

@ -1,4 +1,3 @@
import { expect, describe, it } from "vitest"
import { cron } from "../helpers"
describe("check valid and invalid crons", () => {

View File

@ -5,7 +5,6 @@ import {
SearchFilter,
} from "@budibase/types"
import { buildLuceneQuery, runLuceneQuery } from "../filters"
import { expect, describe, it, test } from "vitest"
describe("runLuceneQuery", () => {
const docs = [
@ -194,7 +193,7 @@ describe("runLuceneQuery", () => {
expect(runLuceneQuery(docs, query).map(row => row.order_id)).toEqual([2, 3])
})
test.each([[523, 259], "523,259"])(
it.each([[523, 259], "523,259"])(
"should return rows with matches on numeric oneOf filter",
input => {
const query = buildQuery({
@ -209,7 +208,7 @@ describe("runLuceneQuery", () => {
}
)
test.each([
it.each([
[false, []],
[true, [1, 2, 3]],
])("should return %s if allOr is %s ", (allOr, expectedResult) => {

View File

@ -18,13 +18,6 @@
},
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"include": ["**/*.js", "**/*.ts"],
"exclude": [
"node_modules",
"dist",
"**/*.spec.ts",
"**/*.spec.js",
"__mocks__",
"src/tests"
]
"include": ["src/**/*"],
"exclude": ["**/*.spec.ts", "**/*.spec.js", "__mocks__", "src/tests"]
}

View File

@ -1,9 +1,8 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"baseUrl": "..",
"rootDir": "src",
"composite": true
"composite": true,
"types": ["node", "jest"]
},
"exclude": ["node_modules", "dist"]
}

View File

@ -3,7 +3,7 @@
"version": "0.0.0",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"types": "src/index.ts",
"author": "Budibase",
"license": "GPL-3.0",
"scripts": {

View File

@ -7,7 +7,7 @@ import {
ViewTemplateOpts,
} from "../"
import { Writable } from "stream"
import PouchDB from "pouchdb-find"
import type PouchDB from "pouchdb-find"
export enum SearchIndex {
ROWS = "rows",

View File

@ -1,8 +1,6 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": "./src",
"composite": true
},
"exclude": ["node_modules", "dist"]

View File

@ -4,10 +4,10 @@ set -e
if [[ -n $CI ]]
then
# Running in ci, where resources are limited
echo "jest --coverage --maxWorkers=2 --forceExit --bail $@"
jest --coverage --maxWorkers=2 --forceExit --bail $@
echo "jest --coverage --maxWorkers=2 --forceExit --bail $@"
jest --coverage --maxWorkers=2 --forceExit --bail $@
else
# --maxWorkers performs better in development
echo "jest --coverage --maxWorkers=2 --forceExit $@"
jest --coverage --maxWorkers=2 --forceExit $@
echo "jest --coverage --detectOpenHandles $@"
jest --coverage --detectOpenHandles $@
fi

View File

@ -6,6 +6,8 @@ import { TestConfiguration } from "../../../tests"
describe("auth", () => {
const config = new TestConfiguration()
afterAll(config.afterAll)
describe("resetUpdate", () => {
it("providing a valid code will update the password", async () => {
await context.doInTenant(structures.tenant.id(), async () => {