mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
try transfering config to ts(but import is failing)
This commit is contained in:
1 parent
0a730e4eef
commit
004d232a84
2 files changed
+11
-21
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { defineConfig } from 'cypress'
|
||||
import process from 'process'
|
||||
import dotenv from 'dotenv'
|
||||
import fs from 'fs' // Import fs module
|
||||
const { defineConfig } = require('cypress')
|
||||
const process = require('process')
|
||||
const dotenv = require('dotenv')
|
||||
const fs = require('fs')
|
||||
|
||||
dotenv.config({ path: '../.env.dev' })
|
||||
dotenv.config({ path: '../.env' })
|
||||
@@ -9,19 +9,17 @@ dotenv.config({ path: '../.env' })
|
||||
const getConfig = (key, defaultValue) => {
|
||||
return process.env[key] || defaultValue
|
||||
}
|
||||
|
||||
const getOrFail = (key) => {
|
||||
const value = getConfig(key)
|
||||
if (!value) {
|
||||
const value = getConfig(key, null)
|
||||
if (value === null) {
|
||||
throw new Error(`Missing required environment variable ${key}`)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
// Check if the .env file exists
|
||||
const EnableoAuth = fs.existsSync('../.env')
|
||||
|
||||
export default defineConfig({
|
||||
module.exports = defineConfig({
|
||||
e2e: {
|
||||
baseUrl: getConfig('BASE_URL', 'http://localhost:5173'),
|
||||
viewportWidth: 1920,
|
||||
@@ -35,13 +33,6 @@ export default defineConfig({
|
||||
defaultAccount: getOrFail('TESTING_USERNAME'),
|
||||
defaultPassword: getOrFail('TESTING_PASSWORD'),
|
||||
isCHVersion: true,
|
||||
EnableoAuth, // Add the EnableoAuth variable here
|
||||
// google_username: process.env.GOOGLE_USERNAME,
|
||||
// google_password: process.env.GOOGLE_PASSWORD,
|
||||
// google_client_id: process.env.GOOGLE_CLIENT_ID,
|
||||
|
||||
// github_username: process.env.GITHUB_USERNAME,
|
||||
// github_password: process.env.GITHUB_PASSWORD,
|
||||
// github_client_id: process.env.GITHUB_CLIENT_ID,
|
||||
EnableoAuth,
|
||||
},
|
||||
})
|
||||
+3
-4
@@ -7,9 +7,8 @@
|
||||
"include": ["node_modules/cypress", "cypress/**/*.ts"],
|
||||
"exclude": [
|
||||
"node_modules/cypress",
|
||||
"cypress.config.mjs",
|
||||
"cypress/support/e2e.js",
|
||||
"../packages/utils/**/*.ts",
|
||||
"../packages/file-graph/**/*.ts"
|
||||
"cypress.config.ts",
|
||||
"./cypress/support/e2e.js",
|
||||
"../packages"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user