Skip to content

Commit e404e76

Browse files
committed
add nee buildspec
1 parent 314e3e1 commit e404e76

File tree

3 files changed

+54
-60
lines changed

3 files changed

+54
-60
lines changed

buildspec/shared/linux-pre_build.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ _SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1111
# Include common functions.
1212
. "${_SCRIPT_DIR}/common.sh"
1313

14-
# Set up GitHub token for vscode-ripgrep to avoid rate limiting
15-
if [ -n "$GITHUB_TOKEN" ]; then
16-
echo "GITHUB_TOKEN is set. vscode-ripgrep will use this for GitHub API authentication."
17-
else
18-
echo "WARNING: GITHUB_TOKEN is not set. GitHub API requests may be rate-limited."
19-
fi
20-
2114
# If present, log into CodeArtifact. Provides a fallback in case NPM is down.
2215
# Should only affect tests run through Toolkits-hosted CodeBuild.
2316
if [ "$TOOLKITS_CODEARTIFACT_DOMAIN" ] && [ "$TOOLKITS_CODEARTIFACT_REPO" ] && [ "$TOOLKITS_ACCOUNT_ID" ]; then

packages/core/src/test/codewhispererChat/tools/fileSearch.test.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import fs from '../../../shared/fs/fs'
1313
import * as workspaceUtils from '../../../shared/utilities/workspaceUtils'
1414
import * as filesystemUtilities from '../../../shared/filesystemUtilities'
1515

16-
describe('FileSearch', () => {
16+
describe('FileSearch', function () {
1717
let sandbox: sinon.SinonSandbox
1818
let mockUpdates: Writable
1919
const mockWorkspacePath = '/mock/workspace'
2020

21-
beforeEach(() => {
21+
beforeEach(function () {
2222
sandbox = sinon.createSandbox()
2323

2424
// Create a mock Writable stream for updates
@@ -57,12 +57,12 @@ describe('FileSearch', () => {
5757
sandbox.stub(filesystemUtilities, 'isInDirectory').returns(true)
5858
})
5959

60-
afterEach(() => {
60+
afterEach(function () {
6161
sandbox.restore()
6262
})
6363

64-
describe('constructor', () => {
65-
it('should initialize with provided values', () => {
64+
describe('constructor', function () {
65+
it('should initialize with provided values', function () {
6666
const params: FileSearchParams = {
6767
path: '/test/path',
6868
pattern: '.*\\.ts$',
@@ -79,7 +79,7 @@ describe('FileSearch', () => {
7979
assert.strictEqual((fileSearch as any).pattern.flags, '')
8080
})
8181

82-
it('should initialize with case insensitive pattern by default', () => {
82+
it('should initialize with case insensitive pattern by default', function () {
8383
const params: FileSearchParams = {
8484
path: '/test/path',
8585
pattern: '.*\\.ts$',
@@ -91,18 +91,18 @@ describe('FileSearch', () => {
9191
})
9292
})
9393

94-
describe('validate', () => {
95-
it('should throw an error if path is empty', async () => {
94+
describe('validate', function () {
95+
it('should throw an error if path is empty', async function () {
9696
const fileSearch = new FileSearch({ path: '', pattern: '.*\\.ts$' })
9797
await assert.rejects(async () => await fileSearch.validate(), /Path cannot be empty/)
9898
})
9999

100-
it('should throw an error if path is only whitespace', async () => {
100+
it('should throw an error if path is only whitespace', async function () {
101101
const fileSearch = new FileSearch({ path: ' ', pattern: '.*\\.ts$' })
102102
await assert.rejects(async () => await fileSearch.validate(), /Path cannot be empty/)
103103
})
104104

105-
it('should throw an error if maxDepth is negative', async () => {
105+
it('should throw an error if maxDepth is negative', async function () {
106106
const fileSearch = new FileSearch({
107107
path: '/test/path',
108108
pattern: '.*\\.ts$',
@@ -111,7 +111,7 @@ describe('FileSearch', () => {
111111
await assert.rejects(async () => await fileSearch.validate(), /MaxDepth cannot be negative/)
112112
})
113113

114-
it('should throw an error if path does not exist', async () => {
114+
it('should throw an error if path does not exist', async function () {
115115
sandbox.restore()
116116
sandbox = sinon.createSandbox()
117117
sandbox.stub(fs, 'existsDir').resolves(false)
@@ -127,7 +127,7 @@ describe('FileSearch', () => {
127127
)
128128
})
129129

130-
it('should pass validation with valid path and pattern', async () => {
130+
it('should pass validation with valid path and pattern', async function () {
131131
const fileSearch = new FileSearch({
132132
path: '/valid/path',
133133
pattern: '.*\\.ts$',
@@ -136,8 +136,8 @@ describe('FileSearch', () => {
136136
})
137137
})
138138

139-
describe('queueDescription', () => {
140-
it('should write description for recursive search', () => {
139+
describe('queueDescription', function () {
140+
it('should write description for recursive search', function () {
141141
const fileSearch = new FileSearch({
142142
path: '/test/path',
143143
pattern: '.*\\.ts$',
@@ -155,7 +155,7 @@ describe('FileSearch', () => {
155155
sinon.assert.calledOnce(mockUpdates.end as sinon.SinonSpy)
156156
})
157157

158-
it('should write description for current directory only', () => {
158+
it('should write description for current directory only', function () {
159159
const fileSearch = new FileSearch({
160160
path: '/test/path',
161161
pattern: '.*\\.ts$',
@@ -172,7 +172,7 @@ describe('FileSearch', () => {
172172
)
173173
})
174174

175-
it('should write description for limited depth search', () => {
175+
it('should write description for limited depth search', function () {
176176
const fileSearch = new FileSearch({
177177
path: '/test/path',
178178
pattern: '.*\\.ts$',
@@ -189,7 +189,7 @@ describe('FileSearch', () => {
189189
)
190190
})
191191

192-
it('should use plural form for multiple levels', () => {
192+
it('should use plural form for multiple levels', function () {
193193
const fileSearch = new FileSearch({
194194
path: '/test/path',
195195
pattern: '.*\\.ts$',
@@ -207,8 +207,8 @@ describe('FileSearch', () => {
207207
})
208208
})
209209

210-
describe('requiresAcceptance', () => {
211-
it('should require acceptance when no workspace folders exist', () => {
210+
describe('requiresAcceptance', function () {
211+
it('should require acceptance when no workspace folders exist', function () {
212212
sandbox.restore()
213213
sandbox = sinon.createSandbox()
214214
sandbox.stub(vscode.workspace, 'workspaceFolders').value(undefined)
@@ -222,7 +222,7 @@ describe('FileSearch', () => {
222222
assert.strictEqual(result.requiresAcceptance, true)
223223
})
224224

225-
it('should require acceptance when path is outside workspace', () => {
225+
it('should require acceptance when path is outside workspace', function () {
226226
sandbox.restore()
227227
sandbox = sinon.createSandbox()
228228
sandbox.stub(vscode.workspace, 'workspaceFolders').value([
@@ -243,7 +243,7 @@ describe('FileSearch', () => {
243243
assert.strictEqual(result.requiresAcceptance, true)
244244
})
245245

246-
it('should not require acceptance when path is inside workspace', () => {
246+
it('should not require acceptance when path is inside workspace', function () {
247247
const fileSearch = new FileSearch({
248248
path: '/mock/workspace/subfolder',
249249
pattern: '.*\\.ts$',
@@ -254,18 +254,18 @@ describe('FileSearch', () => {
254254
})
255255
})
256256

257-
describe('invoke', () => {
257+
describe('invoke', function () {
258258
let fileSearch: FileSearch
259259

260-
beforeEach(async () => {
260+
beforeEach(async function () {
261261
fileSearch = new FileSearch({
262262
path: '/test/path',
263263
pattern: '.*\\.ts$',
264264
})
265265
await fileSearch.validate()
266266
})
267267

268-
it('should filter files by regex pattern', async () => {
268+
it('should filter files by regex pattern', async function () {
269269
const result = await fileSearch.invoke()
270270

271271
// Should only include .ts files
@@ -277,7 +277,7 @@ describe('FileSearch', () => {
277277
})
278278
})
279279

280-
it('should handle case sensitivity correctly', async () => {
280+
it('should handle case sensitivity correctly', async function () {
281281
// Create a case-sensitive search for .TS (uppercase)
282282
fileSearch = new FileSearch({
283283
path: '/test/path',
@@ -296,7 +296,7 @@ describe('FileSearch', () => {
296296
})
297297
})
298298

299-
it('should throw an error if file search fails', async () => {
299+
it('should throw an error if file search fails', async function () {
300300
sandbox.restore()
301301
sandbox = sinon.createSandbox()
302302
// Make readDirectoryRecursively throw an error
@@ -315,8 +315,8 @@ describe('FileSearch', () => {
315315
})
316316
})
317317

318-
describe('createOutput', () => {
319-
it('should create output with content', () => {
318+
describe('createOutput', function () {
319+
it('should create output with content', function () {
320320
const fileSearch = new FileSearch({
321321
path: '/test/path',
322322
pattern: '.*\\.ts$',
@@ -332,7 +332,7 @@ describe('FileSearch', () => {
332332
})
333333
})
334334

335-
it('should create output with empty content', () => {
335+
it('should create output with empty content', function () {
336336
const fileSearch = new FileSearch({
337337
path: '/test/path',
338338
pattern: '.*\\.ts$',

packages/core/src/test/codewhispererChat/tools/grepSearch.test.ts

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import { Writable } from 'stream'
1212
import { OutputKind } from '../../../codewhispererChat/tools/toolShared'
1313
import fs from '../../../shared/fs/fs'
1414

15-
describe('GrepSearch', () => {
15+
describe('GrepSearch', function () {
1616
let sandbox: sinon.SinonSandbox
1717
let mockUpdates: Writable
1818
const mockWorkspacePath = '/mock/workspace'
1919

20-
beforeEach(() => {
20+
beforeEach(function () {
2121
sandbox = sinon.createSandbox()
2222

2323
// Create a mock Writable stream for updates
@@ -42,12 +42,12 @@ describe('GrepSearch', () => {
4242
sandbox.stub(fs, 'existsDir').resolves(true)
4343
})
4444

45-
afterEach(() => {
45+
afterEach(function () {
4646
sandbox.restore()
4747
})
4848

49-
describe('constructor', () => {
50-
it('should initialize with default values', () => {
49+
describe('constructor', function () {
50+
it('should initialize with default values', function () {
5151
const params: GrepSearchParams = {
5252
query: 'test-query',
5353
}
@@ -60,7 +60,7 @@ describe('GrepSearch', () => {
6060
assert.strictEqual((grepSearch as any).path, mockWorkspacePath)
6161
})
6262

63-
it('should initialize with provided values', () => {
63+
it('should initialize with provided values', function () {
6464
const params: GrepSearchParams = {
6565
query: 'test-query',
6666
caseSensitive: true,
@@ -79,8 +79,8 @@ describe('GrepSearch', () => {
7979
})
8080
})
8181

82-
describe('getSearchDirectory', () => {
83-
it('should use provided path when available', () => {
82+
describe('getSearchDirectory', function () {
83+
it('should use provided path when available', function () {
8484
const grepSearch = new GrepSearch({
8585
query: 'test-query',
8686
path: '/custom/path',
@@ -90,7 +90,7 @@ describe('GrepSearch', () => {
9090
assert.strictEqual(result, '/custom/path')
9191
})
9292

93-
it('should use workspace folder when path is not provided', () => {
93+
it('should use workspace folder when path is not provided', function () {
9494
const grepSearch = new GrepSearch({
9595
query: 'test-query',
9696
})
@@ -100,19 +100,19 @@ describe('GrepSearch', () => {
100100
})
101101
})
102102

103-
describe('validate', () => {
104-
it('should throw an error if query is empty', async () => {
103+
describe('validate', function () {
104+
it('should throw an error if query is empty', async function () {
105105
const grepSearch = new GrepSearch({ query: '' })
106106
await assert.rejects(async () => await grepSearch.validate(), /Grep search query cannot be empty/)
107107
})
108108

109-
it('should throw an error if query is only whitespace', async () => {
109+
it('should throw an error if query is only whitespace', async function () {
110110
const grepSearch = new GrepSearch({ query: ' ' })
111111

112112
await assert.rejects(async () => await grepSearch.validate(), /Grep search query cannot be empty/)
113113
})
114114

115-
it('should throw an error if path does not exist', async () => {
115+
it('should throw an error if path does not exist', async function () {
116116
sandbox.restore()
117117
sandbox = sinon.createSandbox()
118118
sandbox.stub(fs, 'existsDir').resolves(false)
@@ -128,7 +128,7 @@ describe('GrepSearch', () => {
128128
)
129129
})
130130

131-
it('should pass validation with valid query and path', async () => {
131+
it('should pass validation with valid query and path', async function () {
132132
const grepSearch = new GrepSearch({
133133
query: 'test-query',
134134
path: '/valid/path',
@@ -137,8 +137,8 @@ describe('GrepSearch', () => {
137137
})
138138
})
139139

140-
describe('queueDescription', () => {
141-
it('should write description to updates stream', () => {
140+
describe('queueDescription', function () {
141+
it('should write description to updates stream', function () {
142142
const grepSearch = new GrepSearch({
143143
query: 'test-query',
144144
path: '/test/path',
@@ -157,9 +157,10 @@ describe('GrepSearch', () => {
157157
})
158158
})
159159

160-
describe('invoke', () => {
160+
describe('invoke', function () {
161161
let grepSearch: GrepSearch
162-
beforeEach(async () => {
162+
163+
beforeEach(async function () {
163164
grepSearch = new GrepSearch({
164165
query: 'test-query',
165166
path: '/test/path',
@@ -177,7 +178,7 @@ describe('GrepSearch', () => {
177178
})
178179
})
179180

180-
it('should execute ripgrep and return results', async () => {
181+
it('should execute ripgrep and return results', async function () {
181182
const result = await grepSearch.invoke()
182183
assert.deepStrictEqual(result, {
183184
output: {
@@ -187,14 +188,14 @@ describe('GrepSearch', () => {
187188
})
188189
})
189190

190-
it('should write updates to the provided stream', async () => {
191+
it('should write updates to the provided stream', async function () {
191192
await grepSearch.invoke(mockUpdates)
192193

193194
// eslint-disable-next-line @typescript-eslint/unbound-method
194195
sinon.assert.calledWith(mockUpdates.write as sinon.SinonSpy, 'processed-results')
195196
})
196197

197-
it('should throw an error if ripgrep execution fails', async () => {
198+
it('should throw an error if ripgrep execution fails', async function () {
198199
sandbox.restore()
199200
sandbox = sinon.createSandbox()
200201
// Make ChildProcess.run throw an error
@@ -207,8 +208,8 @@ describe('GrepSearch', () => {
207208
})
208209
})
209210

210-
describe('createOutput', () => {
211-
it('should create output with content', () => {
211+
describe('createOutput', function () {
212+
it('should create output with content', function () {
212213
const grepSearch = new GrepSearch({
213214
query: 'test-query',
214215
})
@@ -223,7 +224,7 @@ describe('GrepSearch', () => {
223224
})
224225
})
225226

226-
it('should create output with default message when content is empty', () => {
227+
it('should create output with default message when content is empty', function () {
227228
const grepSearch = new GrepSearch({
228229
query: 'test-query',
229230
})

0 commit comments

Comments
 (0)