Skip to content

Commit

Permalink
Fix internal lib error by removing path alias (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky authored Jan 5, 2023
1 parent 04ed25d commit 86b9857
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/sixty-mice-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@segment/analytics-next': patch
---

Fix internal lib error by removing path alias.
10 changes: 5 additions & 5 deletions packages/browser/src/browser/__tests__/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-floating-promises */
import { cdnSettingsKitchenSink } from '../../test-helpers/fixtures/cdn-settings'
import { createMockFetchImplementation } from '../../test-helpers/fixtures/create-fetch-method'
import { Context } from '@/core/context'
import { Plugin } from '@/core/plugin'
import { Context } from '../../core/context'
import { Plugin } from '../../core/plugin'
import { JSDOM } from 'jsdom'
import { Analytics, InitOptions } from '../../core/analytics'
import { LegacyDestination } from '../../plugins/ajs-destination'
Expand All @@ -17,7 +17,7 @@ import { PriorityQueue } from '../../lib/priority-queue'
import { getCDN, setGlobalCDNUrl } from '../../lib/parse-cdn'
import { clearAjsBrowserStorage } from '../../test-helpers/browser-storage'
import { parseFetchCall } from '../../test-helpers/fetch-parse'
import { ActionDestination } from '@/plugins/remote-loader'
import { ActionDestination } from '../../plugins/remote-loader'

let fetchCalls: ReturnType<typeof parseFetchCall>[] = []

Expand Down Expand Up @@ -208,7 +208,7 @@ describe('Initialization', () => {
})

it('calls page if initialpageview is set', async () => {
jest.mock('@/core/analytics')
jest.mock('../../core/analytics')
const mockPage = jest.fn().mockImplementation(() => Promise.resolve())
Analytics.prototype.page = mockPage

Expand All @@ -218,7 +218,7 @@ describe('Initialization', () => {
})

it('does not call page if initialpageview is not set', async () => {
jest.mock('@/core/analytics')
jest.mock('../../core/analytics')
const mockPage = jest.fn()
Analytics.prototype.page = mockPage
await AnalyticsBrowser.load({ writeKey }, { initialPageview: false })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('queryString', () => {
})

it('applies query string logic if window.location.hash is present in different formats', async () => {
jest.mock('@/core/analytics')
jest.mock('../../core/analytics')
const mockQueryString = jest
.fn()
.mockImplementation(() => Promise.resolve())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const register = jest.fn()
const addSourceMiddleware = jest.fn()
const on = jest.fn()

jest.mock('@/core/analytics', () => ({
jest.mock('../../core/analytics', () => ({
Analytics: (_: unknown, options?: InitOptions): unknown => ({
track,
identify,
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/core/buffer/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '..'
import { Analytics } from '../../analytics'
import { Context } from '../../context'
import { sleep } from '@/lib/sleep'
import { sleep } from '../../../lib/sleep'
import { User } from '../../user'

describe('PreInitMethodCallBuffer', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/lib/merged-options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSONObject, Options } from '@/core/events/interfaces'
import { JSONObject, Options } from '../core/events/interfaces'
import { LegacySettings } from '../browser'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/plugins/ajs-destination/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Integrations, JSONObject } from '@/core/events'
import { Integrations, JSONObject } from '../../core/events'
import { Alias, Facade, Group, Identify, Page, Track } from '@segment/facade'
import { Analytics, InitOptions } from '../../core/analytics'
import { LegacySettings } from '../../browser'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Analytics } from '@/core/analytics'
import { Analytics } from '../../../core/analytics'
import { pageEnrichment, pageDefaults } from '..'

let ajs: Analytics
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/plugins/page-enrichment/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Context } from '@/core/context'
import type { Plugin } from '@/core/plugin'
import type { Context } from '../../core/context'
import type { Plugin } from '../../core/plugin'

interface PageDefault {
[key: string]: unknown
Expand Down
3 changes: 0 additions & 3 deletions packages/browser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
"resolveJsonModule": true,
"lib": ["es2020", "DOM", "DOM.Iterable"],
"baseUrl": "./src",
"paths": {
"@/*": ["./*"]
},
"keyofStringsOnly": true
},
"exclude": ["node_modules", "dist"]
Expand Down
1 change: 0 additions & 1 deletion packages/config/src/jest/get-module-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const getJestModuleMap = ({ skipPackageMap = doNotMapPackages } = {}) => {
)

return {
'@/(.+)': '<rootDir>/src/$1',
...(skipPackageMap ? {} : moduleNameMapper),
}
}
Expand Down

0 comments on commit 86b9857

Please sign in to comment.