Skip to content

Commit 5eb6b4e

Browse files
authored
Merge pull request #2796 from QwenLM/fix/punycode-and-sandbox-test
fix: resolve punycode to userland package and skip env var test in sandbox
2 parents 52282c3 + e03144e commit 5eb6b4e

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

esbuild.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ esbuild
6666
__dirname,
6767
'packages/web-templates/src/index.ts',
6868
),
69+
// Resolve to userland punycode instead of deprecated node:punycode built-in
70+
punycode: require.resolve('punycode/'),
6971
},
7072
define: {
7173
'process.env.CLI_VERSION': JSON.stringify(pkg.version),

integration-tests/cli/cron-tools.test.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import {
1111
validateModelOutput,
1212
} from '../test-helper.js';
1313

14+
const IS_SANDBOX =
15+
process.env['QWEN_SANDBOX'] &&
16+
process.env['QWEN_SANDBOX']!.toLowerCase() !== 'false';
17+
1418
describe('cron-tools', () => {
1519
let rig: TestRig;
1620

@@ -36,19 +40,24 @@ describe('cron-tools', () => {
3640
expect(result.toLowerCase()).toContain('yes');
3741
});
3842

39-
it('should have cron tools registered when enabled via env var', async () => {
40-
rig = new TestRig();
41-
await rig.setup('cron-tools-env-var');
43+
// Env vars set in the test process are not forwarded into Docker containers,
44+
// so this test cannot pass in sandbox mode.
45+
(IS_SANDBOX ? it.skip : it)(
46+
'should have cron tools registered when enabled via env var',
47+
async () => {
48+
rig = new TestRig();
49+
await rig.setup('cron-tools-env-var');
4250

43-
process.env['QWEN_CODE_ENABLE_CRON'] = '1';
51+
process.env['QWEN_CODE_ENABLE_CRON'] = '1';
4452

45-
const result = await rig.run(
46-
'Do you have access to tools called cron_create, cron_list, and cron_delete? Reply with just "yes" or "no".',
47-
);
53+
const result = await rig.run(
54+
'Do you have access to tools called cron_create, cron_list, and cron_delete? Reply with just "yes" or "no".',
55+
);
4856

49-
validateModelOutput(result, null, 'cron tools via env var');
50-
expect(result.toLowerCase()).toContain('yes');
51-
});
57+
validateModelOutput(result, null, 'cron tools via env var');
58+
expect(result.toLowerCase()).toContain('yes');
59+
},
60+
);
5261

5362
it('should NOT have cron tools by default', async () => {
5463
rig = new TestRig();

0 commit comments

Comments
 (0)