Skip to content

Commit

Permalink
If CI is true, skip
Browse files Browse the repository at this point in the history
  • Loading branch information
dewski committed Dec 18, 2023
1 parent 2edeab4 commit 0e33292
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const tailwindcss = require('tailwindcss')
const autoprefixer = require('autoprefixer')

const isProduction = process.argv.includes('--production')
const isCI = process.env.CI === 'true'
const watch = process.argv.includes('--watch')

const copyChromeManifestPlugin = {
Expand Down Expand Up @@ -69,6 +70,7 @@ const config = {
define: {
ISINSTOCK_URL: isProduction ? '"https://isinstock.com"' : '"http://localhost:3000"',
CHROME_EXTENSION_ID: '"bnglflgcpflggbpbcbpgeaknekceeojd"',
CI: isCI ? 'true' : 'false',
},
drop: isProduction ? ['console'] : [],
loader: {
Expand Down
1 change: 1 addition & 0 deletions src/@types/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
declare const ISINSTOCK_URL: string
declare const CHROME_EXTENSION_ID: string
declare const CI: boolean

declare module '*.css' {
const content: string
Expand Down
10 changes: 10 additions & 0 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ browser.tabs.onUpdated.addListener(
)

browser.runtime.onStartup.addListener(async () => {
// onStartup cannot be tested with puppeteer so we skip it
if (CI) {
return
}

try {
const token = await getBrowserExtensionInstallToken()
if (token !== '') {
Expand All @@ -46,6 +51,11 @@ browser.runtime.onStartup.addListener(async () => {

// Register the install
browser.runtime.onInstalled.addListener(async ({reason}) => {
// onInstalled cannot be tested with puppeteer so we skip it
if (CI) {
return
}

try {
const existingToken = await getBrowserExtensionInstallToken()
if (existingToken !== '') {
Expand Down

0 comments on commit 0e33292

Please sign in to comment.