# Snippets in VS Code test framework

**URL:** https://discourse.julialang.org/t/snippets-in-vs-code-test-framework/125880
**Category:** Tooling
**Tags:** vscode
**Created:** [February 13, 2025, 10:27pm UTC](https://discourse.julialang.org/t/snippets-in-vs-code-test-framework/125880 "2025-02-13T22:27:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![franckgaga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/franckgaga/32/218241_2.png) [@franckgaga](https://discourse.julialang.org/u/franckgaga)
#### Post date: [February 13, 2025, 10:27pm UTC](https://discourse.julialang.org/t/snippets-in-vs-code-test-framework/125880/1 "2025-02-13T22:27:42Z")

</div>

Hi,

I’m trying to update my package to use the new VS Code test framework. In my `runtest.jl` file, I have:

```julia
@testsnippet MySnippet begin
    A = [1 2; 2 4]
end

@testitem "LinModel construction" setup=[MySnippet] begin
    @test A == [1 2; 2 4]
end

```

if I press on the play button here:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/a/5a5ef5d9cf467f27ab6b1f747be68132c4a390cc.png)  
This error is printed in test results:

```plaintext
  Expression: A == [1 2; 2 4]
  UndefVarError: `A` not defined in `Main.var"##233"`
  Suggestion: check for spelling errors or missing imports.

```

I’m using the Julia Extension v.1.83.2 :

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/d/bdff8c71fa1ecd3abd967c20e786f9bcdf75a55e.png)

What I’m I missing ?

---

<div class="post-metadata">

### Author: ![brianguenter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brianguenter/32/29519_2.png) [@brianguenter](https://discourse.julialang.org/u/brianguenter)
#### Post date: [February 13, 2025, 11:01pm UTC](https://discourse.julialang.org/t/snippets-in-vs-code-test-framework/125880/2 "2025-02-13T23:01:31Z")

</div>

Your test runs fine on my system. Maybe try updating your packages and VSCode (I’m on 1.97.0).

sys info:

```julia
julia> versioninfo()
Julia Version 1.11.3
Commit d63adeda50 (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, tigerlake)
Threads: 8 default, 0 interactive, 4 GC (on 16 virtual cores)
Environment:
  JULIA_EDITOR = code.cmd
  JULIA_NUM_THREADS = 8

```

---

<div class="post-metadata">

### Author: ![franckgaga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/franckgaga/32/218241_2.png) [@franckgaga](https://discourse.julialang.org/u/franckgaga)
#### Post date: [February 13, 2025, 11:24pm UTC](https://discourse.julialang.org/t/snippets-in-vs-code-test-framework/125880/3 "2025-02-13T23:24:43Z")

</div>

Thanks for the tips! I first tried to update the julia extension and it was always coming back to v1.83.2. I figured that it was an incompatibility with my VS Code version. And yes my VS Code version was old (june 2024). I updated my VS Code and everything worked after.
