Skip to content

Commit 2d8e366

Browse files
Merge branch 'main' into janewby/WebChat
2 parents c13ee36 + 562f97e commit 2d8e366

File tree

76 files changed

+746
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+746
-197
lines changed

.eslintrc.production.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
overrides:
22
- files:
33
- '__tests__/**/*.js'
4+
- '__tests__/**/*.mjs'
45
- '*.spec.js'
6+
- '*.spec.mjs'
57
- '*.test.js'
8+
- '*.test.mjs'
9+
10+
env:
11+
jest: true
612

713
rules:
814
no-restricted-globals: off

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
245245
- Fixed long citation identifiers break activity layout, in PR [#5507](https://github.com/microsoft/BotFramework-WebChat/pull/5507), by [@OEvgeny](https://github.com/OEvgeny)
246246
- Updated file-based import with `.js` extension and removed the file extension from build config, by [@compulim](https://github.com/compulim), in PR [#5516](https://github.com/microsoft/BotFramework-WebChat/pull/5516)
247247
- Fixed [#5518](https://github.com/microsoft/BotFramework-WebChat/issues/5518). Minimal bundled build should work properly, in PR [#5507](https://github.com/microsoft/BotFramework-WebChat/pull/5507), by [@compulim](https://github.com/compulim)
248+
- Fixed [#5520](https://github.com/microsoft/BotFramework-WebChat/issues/5520). Version information should be injected when installed via npm, in PR [#5521](https://github.com/microsoft/BotFramework-WebChat/pull/5521), by [@compulim](https://github.com/compulim)
248249

249250
# Removed
250251

__tests__/html/fluentTheme/simple.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
);
4949

5050
expect(buildInfo).toHaveProperty('build-tool', 'tsup');
51-
expect(buildInfo).toHaveProperty('module-format', 'esmodules');
51+
expect(buildInfo).toHaveProperty('module-format', 'global');
5252
expect(buildInfo.version).toMatch(/^\d+\.\d+\.\d+($|-)/u);
5353

5454
expect(window.WebChat.FluentThemeProvider).toBeTruthy();

__tests__/html2/basic/bundle/es5.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
expect(metaMap.has('botframework-webchat:core:version')).toBe(true);
4848
expect(metaMap.has('botframework-webchat:core')).toBe(true);
4949
expect(metaMap.has('botframework-webchat:ui:version')).toBe(true);
50+
51+
expect(
52+
metaMap
53+
.get('botframework-webchat:bundle')
54+
.split(';')
55+
.map(value => value.trim())
56+
).toEqual(expect.arrayContaining(['variant=full-es5', 'build-tool=tsup', 'module-format=global']));
5057
});
5158
</script>
5259
</body>

__tests__/html2/basic/bundle/full.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
expect(metaMap.has('botframework-webchat:core:version')).toBe(true);
4848
expect(metaMap.has('botframework-webchat:core')).toBe(true);
4949
expect(metaMap.has('botframework-webchat:ui:version')).toBe(true);
50+
51+
expect(
52+
metaMap
53+
.get('botframework-webchat:bundle')
54+
.split(';')
55+
.map(value => value.trim())
56+
).toEqual(expect.arrayContaining(['variant=full', 'build-tool=tsup', 'module-format=global']));
5057
});
5158
</script>
5259
</body>

__tests__/html2/basic/bundle/minimal.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
expect(metaMap.has('botframework-webchat:core:version')).toBe(true);
4848
expect(metaMap.has('botframework-webchat:core')).toBe(true);
4949
expect(metaMap.has('botframework-webchat:ui:version')).toBe(true);
50+
51+
expect(
52+
metaMap
53+
.get('botframework-webchat:bundle')
54+
.split(';')
55+
.map(value => value.trim())
56+
).toEqual(expect.arrayContaining(['variant=minimal', 'build-tool=tsup', 'module-format=global']));
5057
});
5158
</script>
5259
</body>

__tests__/html2/preact/fluentTheme/simple.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
);
5555

5656
expect(buildInfo).toHaveProperty('build-tool', 'tsup');
57-
expect(buildInfo).toHaveProperty('module-format', 'esmodules');
57+
expect(buildInfo).toHaveProperty('module-format', 'global');
5858
expect(buildInfo.version).toMatch(/^\d+\.\d+\.\d+($|-)/u);
5959

6060
expect(window.WebChat.FluentThemeProvider).toBeTruthy();

jest.legacy.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = {
4747
npm_package_version: '0.0.0-0.jest'
4848
},
4949
moduleDirectories: ['node_modules', 'packages'],
50-
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
50+
moduleFileExtensions: ['js', 'jsx', 'mjs', 'ts', 'tsx'],
5151
rootDir: './',
5252
setupFilesAfterEnv: [
5353
'<rootDir>/__tests__/setup/setupDotEnv.js',
@@ -76,14 +76,14 @@ module.exports = {
7676
],
7777
transform: {
7878
'[\\/]__tests__[\\/]html[\\/]': '<rootDir>/babel-passthru-transformer.js',
79-
'\\.[jt]sx?$': '<rootDir>/babel-jest-config.js'
79+
'\\.m?[jt]sx?$': '<rootDir>/babel-jest-config.js'
8080
},
8181
transformIgnorePatterns: [
8282
// jest-environment-jsdom import packages as browser.
8383
// Packages, such as "uuid", export itself for browser as ES5 + ESM.
8484
// Since jest@28 cannot consume ESM yet, we need to transpile these packages.
8585
`/node_modules/(?!(${TRANSFORM_IGNORE_PACKAGES.join('|')})/)`,
86-
'/packages/(?:test/)?\\w+/(?:lib/|dist/|\\w+\\.js)',
86+
'/packages/(?:test/)?\\w+/(?:lib/|dist/.+?\\.js$|\\w+\\.js)',
8787
...defaults.transformIgnorePatterns.filter(pattern => pattern !== '/node_modules/')
8888
]
8989
};

package-lock.json

Lines changed: 19 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @jest-environment @happy-dom/jest-environment */
2+
3+
test('CommonJS should export matching buildInfo', () => {
4+
const { buildInfo } = jest.requireActual('../../dist/botframework-webchat-api.js');
5+
6+
expect(buildInfo).toHaveProperty('buildTool', 'tsup');
7+
expect(buildInfo).toHaveProperty('moduleFormat', 'commonjs');
8+
});

0 commit comments

Comments
 (0)