Skip to content

Commit

Permalink
fix: hackathon build (#915)
Browse files Browse the repository at this point in the history
Failing because of typescript errors in extension-utils package tests.

Changes:

1. Added new script to explicitly build ALL extensions (uses a slightly
different build than module so this should catch errors that may evade
the module build).
2. Added packages/extension-utils to apix-tests (changes to
extension-utils triggers apix-ci so this is okay).
3. Added build-extensions to apix-ci. Should catch errors in that future
that this PR fixes.
4. Fixed extension-utils package.json. Copy pasta error where it was
trying to be an extension and its not.
5. Fixed type issues extension-utils tests. Most likely caused by
changes being made for the apix explorer refactor. Missed as ci not
runnning the tests. That barn door has not been closed.
  • Loading branch information
bryans99 authored Dec 3, 2021
1 parent eb0a1df commit 67df146
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/workflows/apix-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
yarn
yarn lint:es --quiet
yarn build
yarn build-extensions
yarn dedupe:ci
- name: Run unit tests
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"build:cjs": "lerna exec --stream 'BABEL_ENV=build_cjs babel src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --no-comments'",
"build:es": "lerna exec --stream 'BABEL_ENV=build babel src --root-mode upward --out-dir lib/esm --source-maps --extensions .ts,.tsx --no-comments'",
"build:ts": "lerna exec --stream --sort 'tsc -b tsconfig.build.json'",
"build-extensions": "lerna run bundle",
"dedupe:dev": "yarn-deduplicate -s fewer yarn.lock && yarn",
"dedupe:list": "yarn-deduplicate --list",
"dedupe:ci": "yarn-deduplicate -s fewer --fail --list yarn.lock",
Expand All @@ -56,7 +57,7 @@
"register": "SUPPRESS_NO_CONFIG_WARNING=1 ts-node -O '{ \"module\": \"commonjs\", \"target\": \"es2019\" }' packages/sdk-codegen-scripts/scripts/register.ts",
"test": "yarn jest",
"test:ts": "yarn jest --reporters=default --reporters=jest-junit",
"test:apix": "yarn jest packages/api-explorer/src packages/run-it packages/code-editor packages/extension-api-explorer",
"test:apix": "yarn jest packages/api-explorer/src packages/extension-utils packages/run-it packages/code-editor packages/extension-api-explorer",
"test:apix-e2e": "yarn workspace @looker/api-explorer run test:e2e",
"test:iphone": "xcodebuild test -project swift/looker/looker.xcodeproj -scheme looker-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.4.1' | xcpretty --test --color",
"test:gen": "yarn jest packages/sdk-codegen",
Expand Down
6 changes: 1 addition & 5 deletions packages/extension-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@looker/extension-utils",
"version": "0.1.0",
"description": "Looker Extension Utilities",
"main": "dist/bundle.js",
"main": "lib/index.js",
"module": "lib/esm/index.js",
"sideEffects": false,
"typings": "lib/index.d.ts",
Expand All @@ -22,10 +22,6 @@
"private": false,
"homepage": "https://github.com/looker-open-source/sdk-codegen/tree/main/packages/extension-utils",
"scripts": {
"analyze": "export ANALYZE_MODE=static && yarn bundle",
"bundle": "tsc && webpack --config webpack.prod.config.js",
"deploy": "bin/deploy",
"develop": "webpack serve --hot --disable-host-check --port 8080 --https --config webpack.dev.config.js",
"watch": "yarn lerna exec --scope @looker/extension-utils --stream 'BABEL_ENV=build babel src --root-mode upward --out-dir lib/esm --source-maps --extensions .ts,.tsx --no-comments --watch'"
},
"dependencies": {
Expand Down
5 changes: 4 additions & 1 deletion packages/extension-utils/src/browserAdaptor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

import type { IAPIMethods } from '@looker/sdk-rtl'
import type { ThemeOverrides } from './adaptorUtils'
import { getThemeOverrides } from './adaptorUtils'
import { BrowserAdaptor } from './browserAdaptor'
Expand All @@ -43,7 +44,9 @@ describe('BrowserAdaptor', () => {
...saveLoc,
hostname,
}
expect(new BrowserAdaptor().themeOverrides()).toEqual(expectedOverrides)
expect(new BrowserAdaptor({} as IAPIMethods).themeOverrides()).toEqual(
expectedOverrides
)
window.location = saveLoc
}
)
Expand Down
14 changes: 9 additions & 5 deletions packages/extension-utils/src/extensionAdaptor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
SOFTWARE.
*/
import type { IAPIMethods } from '@looker/sdk-rtl'
import type { ExtensionSDK, LookerHostData } from '@looker/extension-sdk'
import { ExtensionAdaptor } from './extensionAdaptor'
import type { ThemeOverrides } from '@looker/extension-utils'
Expand All @@ -38,11 +39,14 @@ describe('ExtensionAdaptor', () => {
'returns correct font overrides',
(hostType?: string, expectedOverrides?: ThemeOverrides) => {
expect(
new ExtensionAdaptor({
lookerHostData: {
hostType,
} as Readonly<LookerHostData>,
} as ExtensionSDK).themeOverrides()
new ExtensionAdaptor(
{
lookerHostData: {
hostType,
} as Readonly<LookerHostData>,
} as ExtensionSDK,
{} as IAPIMethods
).themeOverrides()
).toEqual(expectedOverrides)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import { screen } from '@testing-library/react'
import { renderWithTheme } from '@looker/components-test-utils'
import React from 'react'
import { defaultConfigurator } from '..'
import { PerfTracker } from './PerfTracker'
import { LoadTimes, PerfTimings } from './perfUtils'

Expand Down Expand Up @@ -73,7 +72,7 @@ describe('PerfTracker', () => {

test('it initializes to no data', () => {
jest.spyOn(PerfTimings.prototype, 'entries').mockReturnValue([])
renderWithTheme(<PerfTracker configurator={defaultConfigurator} />)
renderWithTheme(<PerfTracker />)
expect(
screen.getByText('No performance data is loaded')
).toBeInTheDocument()
Expand All @@ -82,7 +81,7 @@ describe('PerfTracker', () => {
jest
.spyOn(PerfTimings.prototype, 'entries')
.mockReturnValue(mockPerfEntries)
renderWithTheme(<PerfTracker configurator={defaultConfigurator} />)
renderWithTheme(<PerfTracker />)
expect(screen.getByText(/Load Times/i)).toBeInTheDocument()

// check the full url of the first item is shown in PerfChart
Expand All @@ -102,7 +101,7 @@ describe('PerfTracker', () => {
test('shows a "no data" message with performance but no entries', () => {
jest.spyOn(PerfTimings.prototype, 'entries').mockReturnValue([])
PerfTimings.supported = true
renderWithTheme(<PerfTracker configurator={defaultConfigurator} />)
renderWithTheme(<PerfTracker />)
expect(
screen.queryByText('No performance data is loaded')
).toBeInTheDocument()
Expand All @@ -117,7 +116,7 @@ describe('PerfTracker', () => {
})
test('shows a "not supported" message with no performance', () => {
PerfTimings.supported = false
renderWithTheme(<PerfTracker configurator={defaultConfigurator} />)
renderWithTheme(<PerfTracker />)
expect(
screen.queryByText(
'Performance timing is not supported in this browser'
Expand Down

0 comments on commit 67df146

Please sign in to comment.