forked from calcom/cal.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Smoke Tests for packaged embeds and build improvements (calcom#…
…9169) * Fix 2 Factor Auth * Add a sandbox to verify types of embed-react * Add fault types location * Fix type location again * Break types * Ensure that builds are done again when doing pbublish * Debug failure in CI * Make sure unit test files arent used by playwright * Fix embed-react test description * Update .github/workflows/e2e-embed-react.yml Co-authored-by: Omar López <[email protected]> * Remove unnecessary log --------- Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: Omar López <[email protected]>
- Loading branch information
1 parent
484f603
commit a0bf5b4
Showing
16 changed files
with
119 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Packaged | ||
|
||
The tests in this file are run on the packaged code that is published to npm. The packaged code is different from the source code in atleast the following ways | ||
- Not all files go to packaged code.If package.json -> files field is specified then only the files that are specified there would be published. So, one might accidentally miss an important file that's available otherwise. | ||
- The packaged code doesn't have .ts files. Those files are actually converted to .js files and .d.ts files are generated separately for TypeScript support. It allows the package to work in both TypeScript and non TypeScript environments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* @fileoverview | ||
* This file tests two things in 2 ways | ||
* - It is a vitest test file and thus it tests if the code executes without any error. Thus, it tests that package.json->main/module fields are correctly defined. It obviously verifies the assertions as well. | ||
* - It is also validates for it's types and thus verifies that @calcom/embed-react has correctly specified it's types in package.json->types field. | ||
*/ | ||
import { expect, test } from "vitest"; | ||
|
||
// This import may show up as an error in your IDE, but it's fine because typings are available only after embed-react is built. | ||
import { getCalApi } from "@calcom/embed-react"; | ||
|
||
const api = getCalApi(); | ||
|
||
test("Check that the API is available", () => { | ||
expect(api).toBeDefined() | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "@calcom/tsconfig/base.json", | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"target": "ES2015", | ||
"moduleResolution": "Node", | ||
"baseUrl": ".", | ||
"declaration": true, | ||
"jsx": "preserve", | ||
"outDir": "dist", | ||
}, | ||
"include": ["**/*.ts"], | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
import { defineWorkspace } from "vitest/config"; | ||
|
||
const packagedEmbedTestsOnly = process.argv.includes("--packaged-embed-tests-only"); | ||
// defineWorkspace provides a nice type hinting DX | ||
export default defineWorkspace([ | ||
{ | ||
test: { | ||
include: ["packages/**/*.{test,spec}.{ts,js}", "apps/**/*.{test,spec}.{ts,js}"], | ||
// TODO: Ignore the api until tests are fixed | ||
exclude: ["apps/api/**/*", "**/node_modules/**/*"], | ||
}, | ||
}, | ||
{ | ||
test: { | ||
name: "@calcom/closecom", | ||
include: ["packages/app-store/closecom/**/*.{test,spec}.{ts,js}"], | ||
environment: "jsdom", | ||
setupFiles: ["packages/app-store/closecom/test/globals.ts"], | ||
}, | ||
}, | ||
]); | ||
const workspaces = packagedEmbedTestsOnly | ||
? [ | ||
{ | ||
test: { | ||
include: ["packages/embeds/**/*.{test,spec}.{ts,js}"], | ||
environment: "jsdom", | ||
}, | ||
}, | ||
] | ||
: [ | ||
{ | ||
test: { | ||
include: ["packages/**/*.{test,spec}.{ts,js}", "apps/**/*.{test,spec}.{ts,js}"], | ||
// TODO: Ignore the api until tests are fixed | ||
exclude: ["apps/api/**/*", "**/node_modules/**/*", "packages/embeds/**/*"], | ||
}, | ||
}, | ||
{ | ||
test: { | ||
name: "@calcom/closecom", | ||
include: ["packages/app-store/closecom/**/*.{test,spec}.{ts,js}"], | ||
environment: "jsdom", | ||
setupFiles: ["packages/app-store/closecom/test/globals.ts"], | ||
}, | ||
}, | ||
]; | ||
|
||
export default defineWorkspace(workspaces); |